Skip to content

Commit

Permalink
🐛 fix rule parsing when sub-trees contain tests (konveyor#608)
Browse files Browse the repository at this point in the history
This is needed because we now have "tests" folders in our rulesets. With
current logic, if any sub-tree fails to load rulesets, we fail rule
parsing altogether. We only want to fail on fatal errors.

---------

Signed-off-by: Pranav Gaikwad <pgaikwad@redhat.com>
  • Loading branch information
pranavgaikwad authored May 29, 2024
1 parent 8af6f5c commit b816a18
Show file tree
Hide file tree
Showing 25 changed files with 218 additions and 223 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/demo-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,15 +44,15 @@ jobs:
fi
- uses: actions/checkout@v3
if: steps.extract-info.outputs.BUILD_BUNDLE
if: steps.extract-info.outputs.BUILD_BUNDLE == 'true'
with:
fetch-depth: 0
repository: konveyor/java-analyzer-bundle
ref: "${{ steps.extract-info.outputs.JAVA_BUNDLE_REF }}"
path: java-analyzer-bundle

- name: build java analyzer bundle image
if: steps.extract-info.outputs.BUILD_BUNDLE
if: steps.extract-info.outputs.BUILD_BUNDLE == 'true'
working-directory: java-analyzer-bundle
run: |
podman build -t quay.io/konveyor/jdtls-server-base:latest -f Dockerfile .
Expand Down
3 changes: 3 additions & 0 deletions demo-dep-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1494,6 +1494,9 @@
- konveyor.io/dep-source=open-source
- konveyor.io/language=java
prefix: file:///root/.m2/repository/org/yaml/snakeyaml/1.28
- fileURI: file:///analyzer-lsp/examples/inclusion-tests/pom.xml
provider: java
dependencies: []
- fileURI: file:///analyzer-lsp/examples/java/pom.xml
provider: java
dependencies:
Expand Down
60 changes: 21 additions & 39 deletions demo-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -358,42 +358,24 @@
description: "This rule tests includedPaths config of the java provider. There should be two instances of this issue in the example app. \nWe are filtering one of them using includedPaths in provider config.\n"
category: mandatory
incidents:
- uri: file:///examples/java/example/src/main/java/com/example/apps/App.java
message: Only incidents in util/FileReader.java should be found
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import java.io.File;\n 4 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 5 \n 6 public class App \n 7 {\n 8 \n 9 /**\n10 * {@link CustomResourceDefinition}\n11 * @param args\n12 */\n13 public static void main( String[] args )"
lineNumber: 3
variables:
file: file:///examples/java/example/src/main/java/com/example/apps/App.java
kind: Module
name: java.io.File
package: com.example.apps
- uri: file:///examples/java/example/src/main/java/com/example/apps/App.java
message: Only incidents in util/FileReader.java should be found
codeSnip: "12 */\n13 public static void main( String[] args )\n14 {\n15 CustomResourceDefinition crd = new CustomResourceDefinition();\n16 System.out.println( crd );\n17 \n18 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n19 element.get();\n20 \n21 // test file usage\n22 File file = new File(\"test\");\n23 if (file.exists()) {\n24 System.out.println(\"file exists\");\n25 }\n26 }\n27 }\n"
lineNumber: 22
variables:
file: file:///examples/java/example/src/main/java/com/example/apps/App.java
kind: Method
name: main
package: com.example.apps
- uri: file:///examples/java/example/src/main/java/com/example/apps/util/FileReader.java
- uri: file:///examples/inclusion-tests/src/main/java/io/konveyor/util/FileReader.java
message: Only incidents in util/FileReader.java should be found
codeSnip: " 1 package com.example.apps.util;\n 2 \n 3 import java.io.File;\n 4 \n 5 public class FileReader {\n 6 public static void main(String[] args) {\n 7 File file = new File(\"test\");\n 8 if (file.exists()) {\n 9 System.out.println(\"file exists\");\n10 }\n11 }\n12 \n13 }"
codeSnip: " 1 package io.konveyor.util;\n 2 \n 3 import java.io.File;\n 4 \n 5 public class FileReader {\n 6 public static boolean fileExists() {\n 7 File file = new File(\"/test\");\n 8 return true;\n 9 }\n10 }\n"
lineNumber: 3
variables:
file: file:///examples/java/example/src/main/java/com/example/apps/util/FileReader.java
file: file:///examples/inclusion-tests/src/main/java/io/konveyor/util/FileReader.java
kind: Module
name: java.io.File
package: com.example.apps.util
- uri: file:///examples/java/example/src/main/java/com/example/apps/util/FileReader.java
package: io.konveyor.util
- uri: file:///examples/inclusion-tests/src/main/java/io/konveyor/util/FileReader.java
message: Only incidents in util/FileReader.java should be found
codeSnip: " 1 package com.example.apps.util;\n 2 \n 3 import java.io.File;\n 4 \n 5 public class FileReader {\n 6 public static void main(String[] args) {\n 7 File file = new File(\"test\");\n 8 if (file.exists()) {\n 9 System.out.println(\"file exists\");\n10 }\n11 }\n12 \n13 }\n"
codeSnip: " 1 package io.konveyor.util;\n 2 \n 3 import java.io.File;\n 4 \n 5 public class FileReader {\n 6 public static boolean fileExists() {\n 7 File file = new File(\"/test\");\n 8 return true;\n 9 }\n10 }\n"
lineNumber: 7
variables:
file: file:///examples/java/example/src/main/java/com/example/apps/util/FileReader.java
file: file:///examples/inclusion-tests/src/main/java/io/konveyor/util/FileReader.java
kind: Method
name: main
package: com.example.apps.util
name: fileExists
package: io.konveyor.util
effort: 3
java-pomxml-dependencies:
description: ""
Expand Down Expand Up @@ -463,17 +445,17 @@
file: file:///examples/golang/main.go
- uri: file:///examples/java/example/src/main/java/com/example/apps/App.java
message: apiextensions/v1beta1/customresourcedefinitions is deprecated, apiextensions/v1/customresourcedefinitions should be used instead
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import java.io.File;\n 4 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 5 \n 6 public class App \n 7 {\n 8 \n 9 /**\n10 * {@link CustomResourceDefinition}\n11 * @param args\n12 */\n13 public static void main( String[] args )\n14 {"
lineNumber: 4
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 4 \n 5 public class App \n 6 {\n 7 \n 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {"
lineNumber: 3
variables:
file: file:///examples/java/example/src/main/java/com/example/apps/App.java
kind: Module
name: io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition
package: com.example.apps
- uri: file:///examples/java/example/src/main/java/com/example/apps/App.java
message: apiextensions/v1beta1/customresourcedefinitions is deprecated, apiextensions/v1/customresourcedefinitions should be used instead
codeSnip: " 5 \n 6 public class App \n 7 {\n 8 \n 9 /**\n10 * {@link CustomResourceDefinition}\n11 * @param args\n12 */\n13 public static void main( String[] args )\n14 {\n15 CustomResourceDefinition crd = new CustomResourceDefinition();\n16 System.out.println( crd );\n17 \n18 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n19 element.get();\n20 \n21 // test file usage\n22 File file = new File(\"test\");\n23 if (file.exists()) {\n24 System.out.println(\"file exists\");\n25 }"
lineNumber: 15
codeSnip: " 4 \n 5 public class App \n 6 {\n 7 \n 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {\n14 CustomResourceDefinition crd = new CustomResourceDefinition();\n15 System.out.println( crd );\n16 \n17 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n"
lineNumber: 14
variables:
file: file:///examples/java/example/src/main/java/com/example/apps/App.java
kind: Method
Expand All @@ -484,18 +466,18 @@
category: potential
incidents:
- uri: file:///examples/java/example/src/main/java/com/example/apps/App.java
message: java found apiextensions/v1/customresourcedefinitions found file:///examples/java/example/src/main/java/com/example/apps/App.java:15
codeSnip: " 5 \n 6 public class App \n 7 {\n 8 \n 9 /**\n10 * {@link CustomResourceDefinition}\n11 * @param args\n12 */\n13 public static void main( String[] args )\n14 {\n15 CustomResourceDefinition crd = new CustomResourceDefinition();\n16 System.out.println( crd );\n17 \n18 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n19 element.get();\n20 \n21 // test file usage\n22 File file = new File(\"test\");\n23 if (file.exists()) {\n24 System.out.println(\"file exists\");\n25 }"
lineNumber: 15
message: java found apiextensions/v1/customresourcedefinitions found file:///examples/java/example/src/main/java/com/example/apps/App.java:14
codeSnip: " 4 \n 5 public class App \n 6 {\n 7 \n 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {\n14 CustomResourceDefinition crd = new CustomResourceDefinition();\n15 System.out.println( crd );\n16 \n17 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n"
lineNumber: 14
variables:
file: file:///examples/java/example/src/main/java/com/example/apps/App.java
kind: Method
name: main
package: com.example.apps
- uri: file:///examples/java/example/src/main/java/com/example/apps/App.java
message: java found apiextensions/v1/customresourcedefinitions found file:///examples/java/example/src/main/java/com/example/apps/App.java:4
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import java.io.File;\n 4 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 5 \n 6 public class App \n 7 {\n 8 \n 9 /**\n10 * {@link CustomResourceDefinition}\n11 * @param args\n12 */\n13 public static void main( String[] args )\n14 {"
lineNumber: 4
message: java found apiextensions/v1/customresourcedefinitions found file:///examples/java/example/src/main/java/com/example/apps/App.java:3
codeSnip: " 1 package com.example.apps;\n 2 \n 3 import io.fabric8.kubernetes.api.model.apiextensions.v1beta1.CustomResourceDefinition;\n 4 \n 5 public class App \n 6 {\n 7 \n 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {"
lineNumber: 3
variables:
file: file:///examples/java/example/src/main/java/com/example/apps/App.java
kind: Module
Expand All @@ -507,8 +489,8 @@
incidents:
- uri: file:///examples/java/example/src/main/java/com/example/apps/App.java
message: found generic call
codeSnip: " 9 /**\n10 * {@link CustomResourceDefinition}\n11 * @param args\n12 */\n13 public static void main( String[] args )\n14 {\n15 CustomResourceDefinition crd = new CustomResourceDefinition();\n16 System.out.println( crd );\n17 \n18 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n19 element.get();\n20 \n21 // test file usage\n22 File file = new File(\"test\");\n23 if (file.exists()) {\n24 System.out.println(\"file exists\");\n25 }\n26 }\n27 }\n"
lineNumber: 19
codeSnip: " 8 /**\n 9 * {@link CustomResourceDefinition}\n10 * @param args\n11 */\n12 public static void main( String[] args )\n13 {\n14 CustomResourceDefinition crd = new CustomResourceDefinition();\n15 System.out.println( crd );\n16 \n17 GenericClass<String> element = new GenericClass<String>(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n"
lineNumber: 18
variables:
VariableName: element
file: file:///examples/java/example/src/main/java/com/example/apps/App.java
Expand Down
24 changes: 11 additions & 13 deletions external-providers/dotnet-external-provider/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,38 +3,37 @@ module github.com/konveyor/dotnet-external-provider
go 1.20

require (
github.com/konveyor/analyzer-lsp v0.3.0-rc.3.0.20240320135757-2e45db376985
github.com/konveyor/analyzer-lsp v0.4.0-alpha.1.0.20240520232004-8af6f5c84a59
go.lsp.dev/jsonrpc2 v0.10.0
go.lsp.dev/protocol v0.12.0
go.lsp.dev/uri v0.3.0
)

require github.com/sirupsen/logrus v1.9.3
require (
github.com/sirupsen/logrus v1.9.3
github.com/swaggest/openapi-go v0.2.50
)

require (
github.com/josharian/intern v1.0.0 // indirect
github.com/perimeterx/marshmallow v1.1.5 // indirect
github.com/golang-jwt/jwt/v5 v5.2.1 // indirect
github.com/kr/pretty v0.3.1 // indirect
github.com/rogpeppe/go-internal v1.12.0 // indirect
github.com/stretchr/testify v1.9.0 // indirect
github.com/swaggest/jsonschema-go v0.3.70 // indirect
github.com/swaggest/openapi-go v0.2.50 // indirect
github.com/swaggest/refl v1.3.0 // indirect
go.opentelemetry.io/otel/metric v1.24.0 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240318140521-94a12d6c2237 // indirect
gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect
)

require (
github.com/PaesslerAG/gval v1.2.2 // indirect
github.com/bombsimon/logrusr/v3 v3.1.0
github.com/cbroglie/mustache v1.4.0 // indirect
github.com/getkin/kin-openapi v0.123.0
github.com/go-logr/logr v1.4.1
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.21.0 // indirect
github.com/go-openapi/swag v0.23.0 // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/hashicorp/go-version v1.6.0 // indirect
github.com/invopop/yaml v0.2.0 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mohae/deepcopy v0.0.0-20170929034955-c48cc78d4826 // indirect
github.com/segmentio/asm v1.2.0 // indirect
github.com/segmentio/encoding v0.4.0 // indirect
github.com/shopspring/decimal v1.3.1 // indirect
Expand All @@ -49,7 +48,6 @@ require (
golang.org/x/sys v0.18.0 // indirect
golang.org/x/text v0.14.0 // indirect
google.golang.org/grpc v1.62.1 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.33.1-0.20240408130810-98873a205002 // indirect
gopkg.in/yaml.v2 v2.4.0
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit b816a18

Please sign in to comment.