diff --git a/cmd/analyzer/main.go b/cmd/analyzer/main.go index b64a46ed..5e6d446e 100644 --- a/cmd/analyzer/main.go +++ b/cmd/analyzer/main.go @@ -127,20 +127,13 @@ func AnalysisCmd() *cobra.Command { os.Exit(1) } - engineCtx, engineSpan := tracing.StartNewSpan(ctx, "rule-engine") - //start up the rule eng - eng := engine.CreateRuleEngine(engineCtx, - 10, - log, - engine.WithIncidentLimit(limitIncidents), - engine.WithCodeSnipLimit(limitCodeSnips), - engine.WithContextLines(contextLines), - engine.WithIncidentSelector(incidentSelector), - ) providers := map[string]provider.InternalProviderClient{} - + providerLocations := []string{} for _, config := range configs { config.ContextLines = contextLines + for _, ind := range config.InitConfig { + providerLocations = append(providerLocations, ind.Location) + } // IF analsyis mode is set from the CLI, then we will override this for each init config if analysisMode != "" { inits := []provider.InitConfig{} @@ -163,6 +156,19 @@ func AnalysisCmd() *cobra.Command { } } } + + engineCtx, engineSpan := tracing.StartNewSpan(ctx, "rule-engine") + //start up the rule eng + eng := engine.CreateRuleEngine(engineCtx, + 10, + log, + engine.WithIncidentLimit(limitIncidents), + engine.WithCodeSnipLimit(limitCodeSnips), + engine.WithContextLines(contextLines), + engine.WithIncidentSelector(incidentSelector), + engine.WithLocationPrefixes(providerLocations), + ) + if getOpenAPISpec != "" { sc := createOpenAPISchema(providers, log) b, err := json.Marshal(sc) diff --git a/demo-output.yaml b/demo-output.yaml index 05bfa1b3..251dd458 100644 --- a/demo-output.yaml +++ b/demo-output.yaml @@ -10,7 +10,7 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: ch.qos.logbacklogback-classic1.1.7 codeSnip: "108 \t\t\thibernate-entitymanager\n109 \t\t\t${hibernate.version}\n110 \t\t\n111 \t\t\n112 \t\t\torg.hibernate.validator\n113 \t\t\thibernate-validator\n114 \t\t\t${hibernate-validator.version}\n115 \t\t\n116 \t\t\n117 \t\t\tch.qos.logback\n118 \t\t\tlogback-classic\n119 \t\t\t1.1.7\n120 \t\t\n121 \t\t\n122 \t\t\tcom.oracle.database.jdbc\n123 \t\t\tojdbc8\n124 \t\t\t21.1.0.0\n125 \t\t\n126 \t\t\n127 \t\t\torg.postgresql\n128 \t\t\tpostgresql" lineNumber: 117 @@ -18,7 +18,7 @@ data: dependency innerText: "\n\t\t\tch.qos.logback\n\t\t\tlogback-classic\n\t\t\t1.1.7\n\t\t" matchingXML: ch.qos.logbacklogback-classic1.1.7 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: com.fasterxml.jackson.corejackson-core codeSnip: "59 \t\n60 \t\n61 \t\t\n62 \t\t\torg.apache.tomcat\n63 \t\t\ttomcat-servlet-api\n64 \t\t\t${tomcat.version}\n65 \t\t\tprovided\n66 \t\t\n67 \t\t\n68 \t\t\tcom.fasterxml.jackson.core\n69 \t\t\tjackson-core\n70 \t\t\n71 \t\t\n72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind\n74 \t\t\n75 \t\t\n76 \t\t\torg.springframework.data\n77 \t\t\tspring-data-jpa\n78 \t\t\n79 " lineNumber: 68 @@ -26,7 +26,7 @@ data: dependency innerText: "\n\t\t\tcom.fasterxml.jackson.core\n\t\t\tjackson-core\n\t\t" matchingXML: com.fasterxml.jackson.corejackson-core - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: com.fasterxml.jackson.corejackson-databind codeSnip: "63 \t\t\ttomcat-servlet-api\n64 \t\t\t${tomcat.version}\n65 \t\t\tprovided\n66 \t\t\n67 \t\t\n68 \t\t\tcom.fasterxml.jackson.core\n69 \t\t\tjackson-core\n70 \t\t\n71 \t\t\n72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind\n74 \t\t\n75 \t\t\n76 \t\t\torg.springframework.data\n77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}" lineNumber: 72 @@ -34,7 +34,7 @@ data: dependency innerText: "\n\t\t\tcom.fasterxml.jackson.core\n\t\t\tjackson-databind\n\t\t" matchingXML: com.fasterxml.jackson.corejackson-databind - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: com.fasterxml.jacksonjackson-bom${jackson.version}importpom codeSnip: "36 \t\t\tdemo-config\n37 \t\t\tAzure DevOps\n38 \t\t\thttps://pkgs.dev.azure.com/ShawnHurley21/demo-config-utils/_packaging/demo-config/maven/v1\n39 \t\t\n40 \t\n41 \n42 \t\n43 \t\t\n44 \t\t\t\n45 \t\t\t\tcom.fasterxml.jackson\n46 \t\t\t\tjackson-bom\n47 \t\t\t\t${jackson.version}\n48 \t\t\t\timport\n49 \t\t\t\tpom\n50 \t\t\t\n51 \t\t\t\n52 \t\t\t\torg.springframework.data\n53 \t\t\t\tspring-data-bom\n54 \t\t\t\t${spring-data.version}\n55 \t\t\t\timport\n56 \t\t\t\tpom" lineNumber: 45 @@ -42,7 +42,7 @@ data: dependency innerText: "\n\t\t\t\tcom.fasterxml.jackson\n\t\t\t\tjackson-bom\n\t\t\t\t${jackson.version}\n\t\t\t\timport\n\t\t\t\tpom\n\t\t\t" matchingXML: com.fasterxml.jacksonjackson-bom${jackson.version}importpom - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: com.oracle.database.jdbcojdbc821.1.0.0 codeSnip: "113 \t\t\thibernate-validator\n114 \t\t\t${hibernate-validator.version}\n115 \t\t\n116 \t\t\n117 \t\t\tch.qos.logback\n118 \t\t\tlogback-classic\n119 \t\t\t1.1.7\n120 \t\t\n121 \t\t\n122 \t\t\tcom.oracle.database.jdbc\n123 \t\t\tojdbc8\n124 \t\t\t21.1.0.0\n125 \t\t\n126 \t\t\n127 \t\t\torg.postgresql\n128 \t\t\tpostgresql\n129 \t\t\t42.2.23\n130 \t\t\n131 \t\t\n132 \t\t\n133 \t\t\tio.konveyor.demo" lineNumber: 122 @@ -50,7 +50,7 @@ data: dependency innerText: "\n\t\t\tcom.oracle.database.jdbc\n\t\t\tojdbc8\n\t\t\t21.1.0.0\n\t\t" matchingXML: com.oracle.database.jdbcojdbc821.1.0.0 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: io.konveyor.democonfig-utils1.0.0 codeSnip: "124 \t\t\t21.1.0.0\n125 \t\t\n126 \t\t\n127 \t\t\torg.postgresql\n128 \t\t\tpostgresql\n129 \t\t\t42.2.23\n130 \t\t\n131 \t\t\n132 \t\t\n133 \t\t\tio.konveyor.demo\n134 \t\t\tconfig-utils\n135 \t\t\t1.0.0\n136 \t\t\n137 \n138 \t\n139 \t\n140 \t\t\n141 \t\t\t\n142 \t\t\t\torg.apache.maven.plugins\n143 \t\t\t\tmaven-compiler-plugin\n144 \t\t\t\t${maven-compiler-plugin.version}" lineNumber: 133 @@ -58,7 +58,7 @@ data: dependency innerText: "\n\t\t\tio.konveyor.demo\n\t\t\tconfig-utils\n\t\t\t1.0.0\n\t\t" matchingXML: io.konveyor.democonfig-utils1.0.0 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.apache.tomcattomcat-jdbc${tomcat.version}runtime codeSnip: " 92 \t\t\tspring-web\n 93 \t\t\t${spring-framework.version}\n 94 \t\t\n 95 \t\t\n 96 \t\t\torg.springframework.boot\n 97 \t\t\tspring-boot-starter-actuator\n 98 \t\t\t2.5.0\n 99 \t\t\n100 \t\t\n101 \t\t\torg.apache.tomcat\n102 \t\t\ttomcat-jdbc\n103 \t\t\t${tomcat.version}\n104 \t\t\truntime\n105 \t\t\n106 \t\t\n107 \t\t\torg.hibernate\n108 \t\t\thibernate-entitymanager\n109 \t\t\t${hibernate.version}\n110 \t\t\n111 \t\t\n112 \t\t\torg.hibernate.validator" lineNumber: 101 @@ -66,7 +66,7 @@ data: dependency innerText: "\n\t\t\torg.apache.tomcat\n\t\t\ttomcat-jdbc\n\t\t\t${tomcat.version}\n\t\t\truntime\n\t\t" matchingXML: org.apache.tomcattomcat-jdbc${tomcat.version}runtime - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.apache.tomcattomcat-servlet-api${tomcat.version}provided codeSnip: "53 \t\t\t\tspring-data-bom\n54 \t\t\t\t${spring-data.version}\n55 \t\t\t\timport\n56 \t\t\t\tpom\n57 \t\t\t\n58 \t\t\n59 \t\n60 \t\n61 \t\t\n62 \t\t\torg.apache.tomcat\n63 \t\t\ttomcat-servlet-api\n64 \t\t\t${tomcat.version}\n65 \t\t\tprovided\n66 \t\t\n67 \t\t\n68 \t\t\tcom.fasterxml.jackson.core\n69 \t\t\tjackson-core\n70 \t\t\n71 \t\t\n72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind" lineNumber: 62 @@ -74,7 +74,7 @@ data: dependency innerText: "\n\t\t\torg.apache.tomcat\n\t\t\ttomcat-servlet-api\n\t\t\t${tomcat.version}\n\t\t\tprovided\n\t\t" matchingXML: org.apache.tomcattomcat-servlet-api${tomcat.version}provided - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.hibernate.validatorhibernate-validator${hibernate-validator.version} codeSnip: "103 \t\t\t${tomcat.version}\n104 \t\t\truntime\n105 \t\t\n106 \t\t\n107 \t\t\torg.hibernate\n108 \t\t\thibernate-entitymanager\n109 \t\t\t${hibernate.version}\n110 \t\t\n111 \t\t\n112 \t\t\torg.hibernate.validator\n113 \t\t\thibernate-validator\n114 \t\t\t${hibernate-validator.version}\n115 \t\t\n116 \t\t\n117 \t\t\tch.qos.logback\n118 \t\t\tlogback-classic\n119 \t\t\t1.1.7\n120 \t\t\n121 \t\t\n122 \t\t\tcom.oracle.database.jdbc\n123 \t\t\tojdbc8" lineNumber: 112 @@ -82,7 +82,7 @@ data: dependency innerText: "\n\t\t\torg.hibernate.validator\n\t\t\thibernate-validator\n\t\t\t${hibernate-validator.version}\n\t\t" matchingXML: org.hibernate.validatorhibernate-validator${hibernate-validator.version} - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.hibernatehibernate-entitymanager${hibernate.version} codeSnip: " 98 \t\t\t2.5.0\n 99 \t\t\n100 \t\t\n101 \t\t\torg.apache.tomcat\n102 \t\t\ttomcat-jdbc\n103 \t\t\t${tomcat.version}\n104 \t\t\truntime\n105 \t\t\n106 \t\t\n107 \t\t\torg.hibernate\n108 \t\t\thibernate-entitymanager\n109 \t\t\t${hibernate.version}\n110 \t\t\n111 \t\t\n112 \t\t\torg.hibernate.validator\n113 \t\t\thibernate-validator\n114 \t\t\t${hibernate-validator.version}\n115 \t\t\n116 \t\t\n117 \t\t\tch.qos.logback\n118 \t\t\tlogback-classic" lineNumber: 107 @@ -90,7 +90,7 @@ data: dependency innerText: "\n\t\t\torg.hibernate\n\t\t\thibernate-entitymanager\n\t\t\t${hibernate.version}\n\t\t" matchingXML: org.hibernatehibernate-entitymanager${hibernate.version} - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.postgresqlpostgresql42.2.23 codeSnip: "118 \t\t\tlogback-classic\n119 \t\t\t1.1.7\n120 \t\t\n121 \t\t\n122 \t\t\tcom.oracle.database.jdbc\n123 \t\t\tojdbc8\n124 \t\t\t21.1.0.0\n125 \t\t\n126 \t\t\n127 \t\t\torg.postgresql\n128 \t\t\tpostgresql\n129 \t\t\t42.2.23\n130 \t\t\n131 \t\t\n132 \t\t\n133 \t\t\tio.konveyor.demo\n134 \t\t\tconfig-utils\n135 \t\t\t1.0.0\n136 \t\t\n137 \n138 \t" lineNumber: 127 @@ -98,7 +98,7 @@ data: dependency innerText: "\n\t\t\torg.postgresql\n\t\t\tpostgresql\n\t\t\t42.2.23\n\t\t" matchingXML: org.postgresqlpostgresql42.2.23 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.springframework.bootspring-boot-starter-actuator2.5.0 codeSnip: " 87 \t\t\tspring-webmvc\n 88 \t\t\t${spring-framework.version}\n 89 \t\t\n 90 \t\t\n 91 \t\t\torg.springframework\n 92 \t\t\tspring-web\n 93 \t\t\t${spring-framework.version}\n 94 \t\t\n 95 \t\t\n 96 \t\t\torg.springframework.boot\n 97 \t\t\tspring-boot-starter-actuator\n 98 \t\t\t2.5.0\n 99 \t\t\n100 \t\t\n101 \t\t\torg.apache.tomcat\n102 \t\t\ttomcat-jdbc\n103 \t\t\t${tomcat.version}\n104 \t\t\truntime\n105 \t\t\n106 \t\t\n107 \t\t\torg.hibernate" lineNumber: 96 @@ -106,7 +106,7 @@ data: dependency innerText: "\n\t\t\torg.springframework.boot\n\t\t\tspring-boot-starter-actuator\n\t\t\t2.5.0\n\t\t" matchingXML: org.springframework.bootspring-boot-starter-actuator2.5.0 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.springframework.dataspring-data-bom${spring-data.version}importpom codeSnip: "43 \t\t\n44 \t\t\t\n45 \t\t\t\tcom.fasterxml.jackson\n46 \t\t\t\tjackson-bom\n47 \t\t\t\t${jackson.version}\n48 \t\t\t\timport\n49 \t\t\t\tpom\n50 \t\t\t\n51 \t\t\t\n52 \t\t\t\torg.springframework.data\n53 \t\t\t\tspring-data-bom\n54 \t\t\t\t${spring-data.version}\n55 \t\t\t\timport\n56 \t\t\t\tpom\n57 \t\t\t\n58 \t\t\n59 \t\n60 \t\n61 \t\t\n62 \t\t\torg.apache.tomcat\n63 \t\t\ttomcat-servlet-api" lineNumber: 52 @@ -114,7 +114,7 @@ data: dependency innerText: "\n\t\t\t\torg.springframework.data\n\t\t\t\tspring-data-bom\n\t\t\t\t${spring-data.version}\n\t\t\t\timport\n\t\t\t\tpom\n\t\t\t" matchingXML: org.springframework.dataspring-data-bom${spring-data.version}importpom - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.springframework.dataspring-data-jpa codeSnip: "67 \t\t\n68 \t\t\tcom.fasterxml.jackson.core\n69 \t\t\tjackson-core\n70 \t\t\n71 \t\t\n72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind\n74 \t\t\n75 \t\t\n76 \t\t\torg.springframework.data\n77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}\n84 \t\t\n85 \t\t\n86 \t\t\torg.springframework\n87 \t\t\tspring-webmvc" lineNumber: 76 @@ -122,7 +122,7 @@ data: dependency innerText: "\n\t\t\torg.springframework.data\n\t\t\tspring-data-jpa\n\t\t" matchingXML: org.springframework.dataspring-data-jpa - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.springframeworkspring-jdbc${spring-framework.version} codeSnip: "72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind\n74 \t\t\n75 \t\t\n76 \t\t\torg.springframework.data\n77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}\n84 \t\t\n85 \t\t\n86 \t\t\torg.springframework\n87 \t\t\tspring-webmvc\n88 \t\t\t${spring-framework.version}\n89 \t\t\n90 \t\t\n91 \t\t\torg.springframework\n92 \t\t\tspring-web" lineNumber: 81 @@ -130,7 +130,7 @@ data: dependency innerText: "\n\t\t\torg.springframework\n\t\t\tspring-jdbc\n\t\t\t${spring-framework.version}\n\t\t" matchingXML: org.springframeworkspring-jdbc${spring-framework.version} - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.springframeworkspring-web${spring-framework.version} codeSnip: "77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}\n84 \t\t\n85 \t\t\n86 \t\t\torg.springframework\n87 \t\t\tspring-webmvc\n88 \t\t\t${spring-framework.version}\n89 \t\t\n90 \t\t\n91 \t\t\torg.springframework\n92 \t\t\tspring-web\n93 \t\t\t${spring-framework.version}\n94 \t\t\n95 \t\t\n96 \t\t\torg.springframework.boot\n97 \t\t\tspring-boot-starter-actuator" lineNumber: 86 @@ -138,7 +138,7 @@ data: dependency innerText: "\n\t\t\torg.springframework\n\t\t\tspring-web\n\t\t\t${spring-framework.version}\n\t\t" matchingXML: org.springframeworkspring-web${spring-framework.version} - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: org.springframeworkspring-webmvc${spring-framework.version} codeSnip: "77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}\n84 \t\t\n85 \t\t\n86 \t\t\torg.springframework\n87 \t\t\tspring-webmvc\n88 \t\t\t${spring-framework.version}\n89 \t\t\n90 \t\t\n91 \t\t\torg.springframework\n92 \t\t\tspring-web\n93 \t\t\t${spring-framework.version}\n94 \t\t\n95 \t\t\n96 \t\t\torg.springframework.boot\n97 \t\t\tspring-boot-starter-actuator" lineNumber: 86 @@ -146,7 +146,7 @@ data: dependency innerText: "\n\t\t\torg.springframework\n\t\t\tspring-webmvc\n\t\t\t${spring-framework.version}\n\t\t" matchingXML: org.springframeworkspring-webmvc${spring-framework.version} - - uri: file:///analyzer-lsp/examples/java/dummy/pom.xml + - uri: file:///examples/java/dummy/pom.xml message: |- javaxjavaee-api${javaee-api.version}provided @@ -156,7 +156,7 @@ matchingXML: |- javaxjavaee-api${javaee-api.version}provided - - uri: file:///analyzer-lsp/examples/java/example/pom.xml + - uri: file:///examples/java/example/pom.xml message: |- javaxjavaee-api${javaee-api.version}provided @@ -166,7 +166,7 @@ matchingXML: |- javaxjavaee-api${javaee-api.version}provided - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: io.fabric8kubernetes-client-api6.0.0 codeSnip: |- 31 4.11 @@ -195,7 +195,7 @@ data: dependency innerText: "\n io.fabric8\n kubernetes-client-api\n 6.0.0\n " matchingXML: io.fabric8kubernetes-client-api6.0.0 - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: io.fabric8kubernetes-client6.0.0 codeSnip: "26 \n27 \n28 \n29 junit\n30 junit\n31 4.11\n32 test\n33 \n34 \n35 io.fabric8\n36 kubernetes-client\n37 6.0.0\n38 \n39 \n40 io.fabric8\n41 kubernetes-client-api\n42 6.0.0\n43 \n44 \n45 javax\n46 javaee-api" lineNumber: 35 @@ -203,7 +203,7 @@ data: dependency innerText: "\n io.fabric8\n kubernetes-client\n 6.0.0\n " matchingXML: io.fabric8kubernetes-client6.0.0 - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: io.nettynetty-transport-native-epoll4.1.76.Finallinux-x86_64runtime codeSnip: "43 \n44 \n45 javax\n46 javaee-api\n47 ${javaee-api.version}\n48 provided\n49 \n50 \n51 \n52 io.netty\n53 netty-transport-native-epoll\n54 4.1.76.Final\n55 linux-x86_64\n56 runtime\n57 \n58 \n59 \n60 \n61 \n62 \n63 " lineNumber: 52 @@ -211,7 +211,7 @@ data: dependency innerText: "\n io.netty\n netty-transport-native-epoll\n 4.1.76.Final\n linux-x86_64\n runtime\n " matchingXML: io.nettynetty-transport-native-epoll4.1.76.Finallinux-x86_64runtime - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: javaxjavaee-api${javaee-api.version}provided codeSnip: |- 36 kubernetes-client @@ -240,7 +240,7 @@ data: dependency innerText: "\n javax\n javaee-api\n ${javaee-api.version}\n provided\n " matchingXML: javaxjavaee-api${javaee-api.version}provided - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: junitjunit4.11test codeSnip: "20 \n21 UTF-8\n22 1.7\n23 1.7\n24 7.0\n25 \n26 \n27 \n28 \n29 junit\n30 junit\n31 4.11\n32 test\n33 \n34 \n35 io.fabric8\n36 kubernetes-client\n37 6.0.0\n38 \n39 \n40 io.fabric8" lineNumber: 29 @@ -255,9 +255,9 @@ - test - testing incidents: - - uri: file:///analyzer-lsp/examples/golang/dummy/test_functions.go + - uri: file:///examples/golang/dummy/test_functions.go message: all go files - - uri: file:///analyzer-lsp/examples/golang/main.go + - uri: file:///examples/golang/main.go message: all go files links: - url: https://go.dev @@ -267,7 +267,7 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/Dockerfile + - uri: file:///examples/customers-tomcat-legacy/Dockerfile message: Found usage of openjdk base image codeSnip: " 1 ########################################\n 2 # Build Image\n 3 ########################################\n 4 # FROM maven:3.6-jdk-8-slim as build\n 5 FROM maven:3.8-openjdk-11 as build\n 6 \n 7 WORKDIR /app\n 8 \n 9 # Establish the dependency layer\n10 COPY pom.xml .\n11 RUN mvn dependency:resolve\n12 \n13 # Add the source code and package\n14 COPY src ./src\n15 RUN mvn package\n16 " lineNumber: 5 @@ -277,27 +277,27 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/golang/main.go - message: golang apiextensions/v1/customresourcedefinitions found file:///analyzer-lsp/examples/golang/main.go:11 + - uri: file:///examples/golang/main.go + message: golang apiextensions/v1/customresourcedefinitions found file:///examples/golang/main.go:11 codeSnip: " 2 \n 3 import (\n 4 \t\"fmt\"\n 5 \n 6 \t\"github.com/konveyor/analyzer-lsp/examples/golang/dummy\"\n 7 \t\"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1\"\n 8 )\n 9 \n10 func main() {\n11 \tfmt.Println(v1beta1.CustomResourceDefinition{})\n12 \n13 \tfmt.Println(dummy.HelloWorld())\n14 }\n" lineNumber: 11 variables: - file: file:///analyzer-lsp/examples/golang/main.go + file: file:///examples/golang/main.go golang-gomod-dependencies: description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/golang/go.mod + - uri: file:///examples/golang/go.mod message: dependency golang.org/x/text with v0.3.7 is bad and you should feel bad for using it variables: name: golang.org/x/text version: v0.3.7 - - uri: file:///analyzer-lsp/examples/golang/go.mod + - uri: file:///examples/golang/go.mod message: dependency k8s.io/apimachinery with v0.24.4 is bad and you should feel bad for using it variables: name: k8s.io/apimachinery version: v0.24.4 - - uri: file:///analyzer-lsp/examples/golang/go.mod + - uri: file:///examples/golang/go.mod message: dependency sigs.k8s.io/structured-merge-diff/v4 with v4.2.1 is bad and you should feel bad for using it variables: name: sigs.k8s.io/structured-merge-diff/v4 @@ -306,14 +306,14 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: dependency io.fabric8.kubernetes-client with 6.0.0 is bad and you should feel bad for using it codeSnip: "26 \n27 \n28 \n29 junit\n30 junit\n31 4.11\n32 test\n33 \n34 \n35 io.fabric8\n36 kubernetes-client\n37 6.0.0\n38 \n39 \n40 io.fabric8\n41 kubernetes-client-api\n42 6.0.0\n43 \n44 \n45 javax\n46 javaee-api" lineNumber: 35 variables: name: io.fabric8.kubernetes-client version: 6.0.0 - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: dependency junit.junit with 4.11 is bad and you should feel bad for using it codeSnip: "20 \n21 UTF-8\n22 1.7\n23 1.7\n24 7.0\n25 \n26 \n27 \n28 \n29 junit\n30 junit\n31 4.11\n32 test\n33 \n34 \n35 io.fabric8\n36 kubernetes-client\n37 6.0.0\n38 \n39 \n40 io.fabric8" lineNumber: 29 @@ -324,7 +324,7 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/java/jboss-app.xml + - uri: file:///examples/java/jboss-app.xml message: JBoss 5.x EAR descriptor (jboss-app.xml) was found with public-id variables: data: module @@ -334,7 +334,7 @@ description: Check for usage of deprecated Kubernetes API versions category: potential incidents: - - uri: file:///analyzer-lsp/examples/yaml/k8s.yaml + - uri: file:///examples/yaml/k8s.yaml message: Deprecated/removed Kubernetes API version 'extensions/v1beta1' is used for 'Deployment'. Consider using 'apps/v1'. lineNumber: 16 variables: @@ -348,7 +348,7 @@ description: Check for usage of deprecated Kubernetes API versions category: potential incidents: - - uri: file:///analyzer-lsp/examples/yaml/k8s.yaml + - uri: file:///examples/yaml/k8s.yaml message: Deprecated Kubernetes API version 'apps/v1beta1' is used for 'StatefulSet'. Consider using 'apps/v1'. lineNumber: 38 variables: @@ -362,27 +362,27 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/golang/main.go + - uri: file:///examples/golang/main.go message: apiextensions/v1beta1/customresourcedefinitions is deprecated, apiextensions/v1/customresourcedefinitions should be used instead codeSnip: " 2 \n 3 import (\n 4 \t\"fmt\"\n 5 \n 6 \t\"github.com/konveyor/analyzer-lsp/examples/golang/dummy\"\n 7 \t\"k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1\"\n 8 )\n 9 \n10 func main() {\n11 \tfmt.Println(v1beta1.CustomResourceDefinition{})\n12 \n13 \tfmt.Println(dummy.HelloWorld())\n14 }\n" lineNumber: 11 variables: - file: file:///analyzer-lsp/examples/golang/main.go - - uri: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java + 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 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:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java + 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:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java + - 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: " 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 element = new GenericClass(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n" lineNumber: 14 variables: - file: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java + file: file:///examples/java/example/src/main/java/com/example/apps/App.java kind: Method name: main package: com.example.apps @@ -390,21 +390,21 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java - message: java found apiextensions/v1/customresourcedefinitions found file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java:14 + - 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: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 element = new GenericClass(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n" lineNumber: 14 variables: - file: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java + file: file:///examples/java/example/src/main/java/com/example/apps/App.java kind: Method name: main package: com.example.apps - - uri: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java - message: java found apiextensions/v1/customresourcedefinitions found file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java:3 + - 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: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:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java + 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 @@ -412,13 +412,13 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java + - uri: file:///examples/java/example/src/main/java/com/example/apps/App.java message: found generic call 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 element = new GenericClass(\"Hello world!\");\n18 element.get();\n19 }\n20 }\n" lineNumber: 18 variables: VariableName: element - file: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/App.java + file: file:///examples/java/example/src/main/java/com/example/apps/App.java kind: Method name: main package: com.example.apps @@ -435,51 +435,51 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/python/file_a.py + - uri: file:///examples/python/file_a.py message: python sample rule 001 codeSnip: " 1 import file_b\n 2 \n 3 print(file_b.hello_world())\n 4 \n 5 doggie = file_b.Dog()\n 6 print(doggie.speak())\n 7 \n 8 file_b.bad_method()\n" lineNumber: 3 variables: - file: file:///analyzer-lsp/examples/python/file_a.py + file: file:///examples/python/file_a.py python-sample-rule-002: description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/python/file_a.py + - uri: file:///examples/python/file_a.py message: python sample rule 002 codeSnip: " 1 import file_b\n 2 \n 3 print(file_b.hello_world())\n 4 \n 5 doggie = file_b.Dog()\n 6 print(doggie.speak())\n 7 \n 8 file_b.bad_method()\n" lineNumber: 6 variables: - file: file:///analyzer-lsp/examples/python/file_a.py + file: file:///examples/python/file_a.py python-sample-rule-003: description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/python/main.py + - uri: file:///examples/python/main.py message: python sample rule 003 codeSnip: "19 # Create an instance of the API class\n20 api_instance = kubernetes.client.ApiextensionsV1Api(api_client)\n21 body = kubernetes.client.V1CustomResourceDefinition() # V1CustomResourceDefinition | \n22 pretty = 'pretty_example' # str | If 'true', then the output is pretty printed. (optional)\n23 dry_run = 'dry_run_example' # str | When present, indicates that modifications should not be persisted. An invalid or unrecognized dryRun directive will result in an error response and no further processing of the request. Valid values are: - All: all dry run stages will be processed (optional)\n24 field_manager = 'field_manager_example' # str | fieldManager is a name associated with the actor or entity that is making these changes. The value must be less than or 128 characters long, and only contain printable characters, as defined by https://golang.org/pkg/unicode/#IsPrint. (optional)\n25 field_validation = 'field_validation_example' # str | fieldValidation instructs the server on how to handle objects in the request (POST/PUT/PATCH) containing unknown or duplicate fields. Valid values are: - Ignore: This will ignore any unknown fields that are silently dropped from the object, and will ignore all but the last duplicate field that the decoder encounters. This is the default behavior prior to v1.23. - Warn: This will send a warning via the standard warning response header for each unknown field that is dropped from the object, and for each duplicate field that is encountered. The request will still succeed if there are no other errors, and will only persist the last of any duplicate fields. This is the default in v1.23+ - Strict: This will fail the request with a BadRequest error if any unknown fields would be dropped from the object, or if any duplicate fields are present. The error returned from the server will contain all unknown and duplicate fields encountered. (optional)\n26 \n27 try:\n28 api_response = api_instance.create_custom_resource_definition(body, pretty=pretty, dry_run=dry_run, field_manager=field_manager, field_validation=field_validation)\n29 pprint(api_response)\n30 except ApiException as e:\n31 print(\"Exception when calling ApiextensionsV1Api->create_custom_resource_definition: %s\\n\" % e)\n" lineNumber: 28 variables: - file: file:///analyzer-lsp/examples/python/main.py + file: file:///examples/python/main.py singleton-sessionbean-00001: description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/Bean.java + - uri: file:///examples/java/example/src/main/java/com/example/apps/Bean.java message: condition entries should evaluate out of order codeSnip: " 1 package com.example.apps;\n 2 \n 3 import javax.ejb.SessionBean;\n 4 import javax.ejb.Singleton;\n 5 \n 6 @Singleton\n 7 public abstract class Bean implements SessionBean {\n 8 }\n" lineNumber: 6 variables: - file: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/Bean.java + file: file:///examples/java/example/src/main/java/com/example/apps/Bean.java kind: Class name: Singleton package: com.example.apps - - uri: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/Bean.java + - uri: file:///examples/java/example/src/main/java/com/example/apps/Bean.java message: condition entries should evaluate out of order codeSnip: " 1 package com.example.apps;\n 2 \n 3 import javax.ejb.SessionBean;\n 4 import javax.ejb.Singleton;\n 5 \n 6 @Singleton\n 7 public abstract class Bean implements SessionBean {\n 8 }\n" lineNumber: 7 variables: - file: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/Bean.java + file: file:///examples/java/example/src/main/java/com/example/apps/Bean.java kind: Class name: Bean package: com.example.apps @@ -487,21 +487,21 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/Bean.java + - uri: file:///examples/java/example/src/main/java/com/example/apps/Bean.java message: condition entries should evaluate in order codeSnip: " 1 package com.example.apps;\n 2 \n 3 import javax.ejb.SessionBean;\n 4 import javax.ejb.Singleton;\n 5 \n 6 @Singleton\n 7 public abstract class Bean implements SessionBean {\n 8 }\n" lineNumber: 6 variables: - file: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/Bean.java + file: file:///examples/java/example/src/main/java/com/example/apps/Bean.java kind: Class name: Singleton package: com.example.apps - - uri: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/Bean.java + - uri: file:///examples/java/example/src/main/java/com/example/apps/Bean.java message: condition entries should evaluate in order codeSnip: " 1 package com.example.apps;\n 2 \n 3 import javax.ejb.SessionBean;\n 4 import javax.ejb.Singleton;\n 5 \n 6 @Singleton\n 7 public abstract class Bean implements SessionBean {\n 8 }\n" lineNumber: 7 variables: - file: file:///analyzer-lsp/examples/java/example/src/main/java/com/example/apps/Bean.java + file: file:///examples/java/example/src/main/java/com/example/apps/Bean.java kind: Class name: Bean package: com.example.apps @@ -524,7 +524,7 @@ description: "" category: potential incidents: - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'ch.qos.logbacklogback-classic1.1.7' codeSnip: "108 \t\t\thibernate-entitymanager\n109 \t\t\t${hibernate.version}\n110 \t\t\n111 \t\t\n112 \t\t\torg.hibernate.validator\n113 \t\t\thibernate-validator\n114 \t\t\t${hibernate-validator.version}\n115 \t\t\n116 \t\t\n117 \t\t\tch.qos.logback\n118 \t\t\tlogback-classic\n119 \t\t\t1.1.7\n120 \t\t\n121 \t\t\n122 \t\t\tcom.oracle.database.jdbc\n123 \t\t\tojdbc8\n124 \t\t\t21.1.0.0\n125 \t\t\n126 \t\t\n127 \t\t\torg.postgresql\n128 \t\t\tpostgresql" lineNumber: 117 @@ -532,7 +532,7 @@ data: dependency innerText: "\n\t\t\tch.qos.logback\n\t\t\tlogback-classic\n\t\t\t1.1.7\n\t\t" matchingXML: ch.qos.logbacklogback-classic1.1.7 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'com.fasterxml.jackson.corejackson-core' codeSnip: "59 \t\n60 \t\n61 \t\t\n62 \t\t\torg.apache.tomcat\n63 \t\t\ttomcat-servlet-api\n64 \t\t\t${tomcat.version}\n65 \t\t\tprovided\n66 \t\t\n67 \t\t\n68 \t\t\tcom.fasterxml.jackson.core\n69 \t\t\tjackson-core\n70 \t\t\n71 \t\t\n72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind\n74 \t\t\n75 \t\t\n76 \t\t\torg.springframework.data\n77 \t\t\tspring-data-jpa\n78 \t\t\n79 " lineNumber: 68 @@ -540,7 +540,7 @@ data: dependency innerText: "\n\t\t\tcom.fasterxml.jackson.core\n\t\t\tjackson-core\n\t\t" matchingXML: com.fasterxml.jackson.corejackson-core - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'com.fasterxml.jackson.corejackson-databind' codeSnip: "63 \t\t\ttomcat-servlet-api\n64 \t\t\t${tomcat.version}\n65 \t\t\tprovided\n66 \t\t\n67 \t\t\n68 \t\t\tcom.fasterxml.jackson.core\n69 \t\t\tjackson-core\n70 \t\t\n71 \t\t\n72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind\n74 \t\t\n75 \t\t\n76 \t\t\torg.springframework.data\n77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}" lineNumber: 72 @@ -548,7 +548,7 @@ data: dependency innerText: "\n\t\t\tcom.fasterxml.jackson.core\n\t\t\tjackson-databind\n\t\t" matchingXML: com.fasterxml.jackson.corejackson-databind - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'com.fasterxml.jacksonjackson-bom${jackson.version}importpom' codeSnip: "36 \t\t\tdemo-config\n37 \t\t\tAzure DevOps\n38 \t\t\thttps://pkgs.dev.azure.com/ShawnHurley21/demo-config-utils/_packaging/demo-config/maven/v1\n39 \t\t\n40 \t\n41 \n42 \t\n43 \t\t\n44 \t\t\t\n45 \t\t\t\tcom.fasterxml.jackson\n46 \t\t\t\tjackson-bom\n47 \t\t\t\t${jackson.version}\n48 \t\t\t\timport\n49 \t\t\t\tpom\n50 \t\t\t\n51 \t\t\t\n52 \t\t\t\torg.springframework.data\n53 \t\t\t\tspring-data-bom\n54 \t\t\t\t${spring-data.version}\n55 \t\t\t\timport\n56 \t\t\t\tpom" lineNumber: 45 @@ -556,7 +556,7 @@ data: dependency innerText: "\n\t\t\t\tcom.fasterxml.jackson\n\t\t\t\tjackson-bom\n\t\t\t\t${jackson.version}\n\t\t\t\timport\n\t\t\t\tpom\n\t\t\t" matchingXML: com.fasterxml.jacksonjackson-bom${jackson.version}importpom - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'com.oracle.database.jdbcojdbc821.1.0.0' codeSnip: "113 \t\t\thibernate-validator\n114 \t\t\t${hibernate-validator.version}\n115 \t\t\n116 \t\t\n117 \t\t\tch.qos.logback\n118 \t\t\tlogback-classic\n119 \t\t\t1.1.7\n120 \t\t\n121 \t\t\n122 \t\t\tcom.oracle.database.jdbc\n123 \t\t\tojdbc8\n124 \t\t\t21.1.0.0\n125 \t\t\n126 \t\t\n127 \t\t\torg.postgresql\n128 \t\t\tpostgresql\n129 \t\t\t42.2.23\n130 \t\t\n131 \t\t\n132 \t\t\n133 \t\t\tio.konveyor.demo" lineNumber: 122 @@ -564,7 +564,7 @@ data: dependency innerText: "\n\t\t\tcom.oracle.database.jdbc\n\t\t\tojdbc8\n\t\t\t21.1.0.0\n\t\t" matchingXML: com.oracle.database.jdbcojdbc821.1.0.0 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'io.konveyor.democonfig-utils1.0.0' codeSnip: "124 \t\t\t21.1.0.0\n125 \t\t\n126 \t\t\n127 \t\t\torg.postgresql\n128 \t\t\tpostgresql\n129 \t\t\t42.2.23\n130 \t\t\n131 \t\t\n132 \t\t\n133 \t\t\tio.konveyor.demo\n134 \t\t\tconfig-utils\n135 \t\t\t1.0.0\n136 \t\t\n137 \n138 \t\n139 \t\n140 \t\t\n141 \t\t\t\n142 \t\t\t\torg.apache.maven.plugins\n143 \t\t\t\tmaven-compiler-plugin\n144 \t\t\t\t${maven-compiler-plugin.version}" lineNumber: 133 @@ -572,7 +572,7 @@ data: dependency innerText: "\n\t\t\tio.konveyor.demo\n\t\t\tconfig-utils\n\t\t\t1.0.0\n\t\t" matchingXML: io.konveyor.democonfig-utils1.0.0 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.apache.tomcattomcat-jdbc${tomcat.version}runtime' codeSnip: " 92 \t\t\tspring-web\n 93 \t\t\t${spring-framework.version}\n 94 \t\t\n 95 \t\t\n 96 \t\t\torg.springframework.boot\n 97 \t\t\tspring-boot-starter-actuator\n 98 \t\t\t2.5.0\n 99 \t\t\n100 \t\t\n101 \t\t\torg.apache.tomcat\n102 \t\t\ttomcat-jdbc\n103 \t\t\t${tomcat.version}\n104 \t\t\truntime\n105 \t\t\n106 \t\t\n107 \t\t\torg.hibernate\n108 \t\t\thibernate-entitymanager\n109 \t\t\t${hibernate.version}\n110 \t\t\n111 \t\t\n112 \t\t\torg.hibernate.validator" lineNumber: 101 @@ -580,7 +580,7 @@ data: dependency innerText: "\n\t\t\torg.apache.tomcat\n\t\t\ttomcat-jdbc\n\t\t\t${tomcat.version}\n\t\t\truntime\n\t\t" matchingXML: org.apache.tomcattomcat-jdbc${tomcat.version}runtime - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.apache.tomcattomcat-servlet-api${tomcat.version}provided' codeSnip: "53 \t\t\t\tspring-data-bom\n54 \t\t\t\t${spring-data.version}\n55 \t\t\t\timport\n56 \t\t\t\tpom\n57 \t\t\t\n58 \t\t\n59 \t\n60 \t\n61 \t\t\n62 \t\t\torg.apache.tomcat\n63 \t\t\ttomcat-servlet-api\n64 \t\t\t${tomcat.version}\n65 \t\t\tprovided\n66 \t\t\n67 \t\t\n68 \t\t\tcom.fasterxml.jackson.core\n69 \t\t\tjackson-core\n70 \t\t\n71 \t\t\n72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind" lineNumber: 62 @@ -588,7 +588,7 @@ data: dependency innerText: "\n\t\t\torg.apache.tomcat\n\t\t\ttomcat-servlet-api\n\t\t\t${tomcat.version}\n\t\t\tprovided\n\t\t" matchingXML: org.apache.tomcattomcat-servlet-api${tomcat.version}provided - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.hibernate.validatorhibernate-validator${hibernate-validator.version}' codeSnip: "103 \t\t\t${tomcat.version}\n104 \t\t\truntime\n105 \t\t\n106 \t\t\n107 \t\t\torg.hibernate\n108 \t\t\thibernate-entitymanager\n109 \t\t\t${hibernate.version}\n110 \t\t\n111 \t\t\n112 \t\t\torg.hibernate.validator\n113 \t\t\thibernate-validator\n114 \t\t\t${hibernate-validator.version}\n115 \t\t\n116 \t\t\n117 \t\t\tch.qos.logback\n118 \t\t\tlogback-classic\n119 \t\t\t1.1.7\n120 \t\t\n121 \t\t\n122 \t\t\tcom.oracle.database.jdbc\n123 \t\t\tojdbc8" lineNumber: 112 @@ -596,7 +596,7 @@ data: dependency innerText: "\n\t\t\torg.hibernate.validator\n\t\t\thibernate-validator\n\t\t\t${hibernate-validator.version}\n\t\t" matchingXML: org.hibernate.validatorhibernate-validator${hibernate-validator.version} - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.hibernatehibernate-entitymanager${hibernate.version}' codeSnip: " 98 \t\t\t2.5.0\n 99 \t\t\n100 \t\t\n101 \t\t\torg.apache.tomcat\n102 \t\t\ttomcat-jdbc\n103 \t\t\t${tomcat.version}\n104 \t\t\truntime\n105 \t\t\n106 \t\t\n107 \t\t\torg.hibernate\n108 \t\t\thibernate-entitymanager\n109 \t\t\t${hibernate.version}\n110 \t\t\n111 \t\t\n112 \t\t\torg.hibernate.validator\n113 \t\t\thibernate-validator\n114 \t\t\t${hibernate-validator.version}\n115 \t\t\n116 \t\t\n117 \t\t\tch.qos.logback\n118 \t\t\tlogback-classic" lineNumber: 107 @@ -604,7 +604,7 @@ data: dependency innerText: "\n\t\t\torg.hibernate\n\t\t\thibernate-entitymanager\n\t\t\t${hibernate.version}\n\t\t" matchingXML: org.hibernatehibernate-entitymanager${hibernate.version} - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.postgresqlpostgresql42.2.23' codeSnip: "118 \t\t\tlogback-classic\n119 \t\t\t1.1.7\n120 \t\t\n121 \t\t\n122 \t\t\tcom.oracle.database.jdbc\n123 \t\t\tojdbc8\n124 \t\t\t21.1.0.0\n125 \t\t\n126 \t\t\n127 \t\t\torg.postgresql\n128 \t\t\tpostgresql\n129 \t\t\t42.2.23\n130 \t\t\n131 \t\t\n132 \t\t\n133 \t\t\tio.konveyor.demo\n134 \t\t\tconfig-utils\n135 \t\t\t1.0.0\n136 \t\t\n137 \n138 \t" lineNumber: 127 @@ -612,7 +612,7 @@ data: dependency innerText: "\n\t\t\torg.postgresql\n\t\t\tpostgresql\n\t\t\t42.2.23\n\t\t" matchingXML: org.postgresqlpostgresql42.2.23 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.springframework.bootspring-boot-starter-actuator2.5.0' codeSnip: " 87 \t\t\tspring-webmvc\n 88 \t\t\t${spring-framework.version}\n 89 \t\t\n 90 \t\t\n 91 \t\t\torg.springframework\n 92 \t\t\tspring-web\n 93 \t\t\t${spring-framework.version}\n 94 \t\t\n 95 \t\t\n 96 \t\t\torg.springframework.boot\n 97 \t\t\tspring-boot-starter-actuator\n 98 \t\t\t2.5.0\n 99 \t\t\n100 \t\t\n101 \t\t\torg.apache.tomcat\n102 \t\t\ttomcat-jdbc\n103 \t\t\t${tomcat.version}\n104 \t\t\truntime\n105 \t\t\n106 \t\t\n107 \t\t\torg.hibernate" lineNumber: 96 @@ -620,7 +620,7 @@ data: dependency innerText: "\n\t\t\torg.springframework.boot\n\t\t\tspring-boot-starter-actuator\n\t\t\t2.5.0\n\t\t" matchingXML: org.springframework.bootspring-boot-starter-actuator2.5.0 - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.springframework.dataspring-data-bom${spring-data.version}importpom' codeSnip: "43 \t\t\n44 \t\t\t\n45 \t\t\t\tcom.fasterxml.jackson\n46 \t\t\t\tjackson-bom\n47 \t\t\t\t${jackson.version}\n48 \t\t\t\timport\n49 \t\t\t\tpom\n50 \t\t\t\n51 \t\t\t\n52 \t\t\t\torg.springframework.data\n53 \t\t\t\tspring-data-bom\n54 \t\t\t\t${spring-data.version}\n55 \t\t\t\timport\n56 \t\t\t\tpom\n57 \t\t\t\n58 \t\t\n59 \t\n60 \t\n61 \t\t\n62 \t\t\torg.apache.tomcat\n63 \t\t\ttomcat-servlet-api" lineNumber: 52 @@ -628,7 +628,7 @@ data: dependency innerText: "\n\t\t\t\torg.springframework.data\n\t\t\t\tspring-data-bom\n\t\t\t\t${spring-data.version}\n\t\t\t\timport\n\t\t\t\tpom\n\t\t\t" matchingXML: org.springframework.dataspring-data-bom${spring-data.version}importpom - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.springframework.dataspring-data-jpa' codeSnip: "67 \t\t\n68 \t\t\tcom.fasterxml.jackson.core\n69 \t\t\tjackson-core\n70 \t\t\n71 \t\t\n72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind\n74 \t\t\n75 \t\t\n76 \t\t\torg.springframework.data\n77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}\n84 \t\t\n85 \t\t\n86 \t\t\torg.springframework\n87 \t\t\tspring-webmvc" lineNumber: 76 @@ -636,7 +636,7 @@ data: dependency innerText: "\n\t\t\torg.springframework.data\n\t\t\tspring-data-jpa\n\t\t" matchingXML: org.springframework.dataspring-data-jpa - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.springframeworkspring-jdbc${spring-framework.version}' codeSnip: "72 \t\t\tcom.fasterxml.jackson.core\n73 \t\t\tjackson-databind\n74 \t\t\n75 \t\t\n76 \t\t\torg.springframework.data\n77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}\n84 \t\t\n85 \t\t\n86 \t\t\torg.springframework\n87 \t\t\tspring-webmvc\n88 \t\t\t${spring-framework.version}\n89 \t\t\n90 \t\t\n91 \t\t\torg.springframework\n92 \t\t\tspring-web" lineNumber: 81 @@ -644,7 +644,7 @@ data: dependency innerText: "\n\t\t\torg.springframework\n\t\t\tspring-jdbc\n\t\t\t${spring-framework.version}\n\t\t" matchingXML: org.springframeworkspring-jdbc${spring-framework.version} - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.springframeworkspring-web${spring-framework.version}' codeSnip: "77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}\n84 \t\t\n85 \t\t\n86 \t\t\torg.springframework\n87 \t\t\tspring-webmvc\n88 \t\t\t${spring-framework.version}\n89 \t\t\n90 \t\t\n91 \t\t\torg.springframework\n92 \t\t\tspring-web\n93 \t\t\t${spring-framework.version}\n94 \t\t\n95 \t\t\n96 \t\t\torg.springframework.boot\n97 \t\t\tspring-boot-starter-actuator" lineNumber: 86 @@ -652,7 +652,7 @@ data: dependency innerText: "\n\t\t\torg.springframework\n\t\t\tspring-web\n\t\t\t${spring-framework.version}\n\t\t" matchingXML: org.springframeworkspring-web${spring-framework.version} - - uri: file:///analyzer-lsp/examples/customers-tomcat-legacy/pom.xml + - uri: file:///examples/customers-tomcat-legacy/pom.xml message: POM XML dependencies - 'org.springframeworkspring-webmvc${spring-framework.version}' codeSnip: "77 \t\t\tspring-data-jpa\n78 \t\t\n79 \n80 \t\t\n81 \t\t\torg.springframework\n82 \t\t\tspring-jdbc\n83 \t\t\t${spring-framework.version}\n84 \t\t\n85 \t\t\n86 \t\t\torg.springframework\n87 \t\t\tspring-webmvc\n88 \t\t\t${spring-framework.version}\n89 \t\t\n90 \t\t\n91 \t\t\torg.springframework\n92 \t\t\tspring-web\n93 \t\t\t${spring-framework.version}\n94 \t\t\n95 \t\t\n96 \t\t\torg.springframework.boot\n97 \t\t\tspring-boot-starter-actuator" lineNumber: 86 @@ -660,7 +660,7 @@ data: dependency innerText: "\n\t\t\torg.springframework\n\t\t\tspring-webmvc\n\t\t\t${spring-framework.version}\n\t\t" matchingXML: org.springframeworkspring-webmvc${spring-framework.version} - - uri: file:///analyzer-lsp/examples/java/dummy/pom.xml + - uri: file:///examples/java/dummy/pom.xml message: |- POM XML dependencies - 'javaxjavaee-api${javaee-api.version}provided' @@ -670,7 +670,7 @@ matchingXML: |- javaxjavaee-api${javaee-api.version}provided - - uri: file:///analyzer-lsp/examples/java/example/pom.xml + - uri: file:///examples/java/example/pom.xml message: |- POM XML dependencies - 'javaxjavaee-api${javaee-api.version}provided' @@ -680,7 +680,7 @@ matchingXML: |- javaxjavaee-api${javaee-api.version}provided - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: POM XML dependencies - 'io.fabric8kubernetes-client-api6.0.0' codeSnip: |- 31 4.11 @@ -709,7 +709,7 @@ data: dependency innerText: "\n io.fabric8\n kubernetes-client-api\n 6.0.0\n " matchingXML: io.fabric8kubernetes-client-api6.0.0 - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: POM XML dependencies - 'io.fabric8kubernetes-client6.0.0' codeSnip: "26 \n27 \n28 \n29 junit\n30 junit\n31 4.11\n32 test\n33 \n34 \n35 io.fabric8\n36 kubernetes-client\n37 6.0.0\n38 \n39 \n40 io.fabric8\n41 kubernetes-client-api\n42 6.0.0\n43 \n44 \n45 javax\n46 javaee-api" lineNumber: 35 @@ -717,7 +717,7 @@ data: dependency innerText: "\n io.fabric8\n kubernetes-client\n 6.0.0\n " matchingXML: io.fabric8kubernetes-client6.0.0 - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: POM XML dependencies - 'io.nettynetty-transport-native-epoll4.1.76.Finallinux-x86_64runtime' codeSnip: "43 \n44 \n45 javax\n46 javaee-api\n47 ${javaee-api.version}\n48 provided\n49 \n50 \n51 \n52 io.netty\n53 netty-transport-native-epoll\n54 4.1.76.Final\n55 linux-x86_64\n56 runtime\n57 \n58 \n59 \n60 \n61 \n62 \n63 " lineNumber: 52 @@ -725,7 +725,7 @@ data: dependency innerText: "\n io.netty\n netty-transport-native-epoll\n 4.1.76.Final\n linux-x86_64\n runtime\n " matchingXML: io.nettynetty-transport-native-epoll4.1.76.Finallinux-x86_64runtime - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: POM XML dependencies - 'javaxjavaee-api${javaee-api.version}provided' codeSnip: |- 36 kubernetes-client @@ -754,7 +754,7 @@ data: dependency innerText: "\n javax\n javaee-api\n ${javaee-api.version}\n provided\n " matchingXML: javaxjavaee-api${javaee-api.version}provided - - uri: file:///analyzer-lsp/examples/java/pom.xml + - uri: file:///examples/java/pom.xml message: POM XML dependencies - 'junitjunit4.11test' codeSnip: "20 \n21 UTF-8\n22 1.7\n23 1.7\n24 7.0\n25 \n26 \n27 \n28 \n29 junit\n30 junit\n31 4.11\n32 test\n33 \n34 \n35 io.fabric8\n36 kubernetes-client\n37 6.0.0\n38 \n39 \n40 io.fabric8" lineNumber: 29 @@ -766,7 +766,7 @@ description: Test code snippets when match is a key of a XML node category: potential incidents: - - uri: file:///analyzer-lsp/examples/java/beans.xml + - uri: file:///examples/java/beans.xml message: The code snippet should point to in the beans.xml file codeSnip: " 8 *\n 9 * http://www.apache.org/licenses/LICENSE-2.0\n10 *\n11 * Unless required by applicable law or agreed to in writing, software\n12 * distributed under the License is distributed on an \"AS IS\" BASIS,\n13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n14 * See the License for the specific language governing permissions and\n15 * limitations under the License.\n16 -->\n17 \n22 \n" lineNumber: 17 diff --git a/engine/engine.go b/engine/engine.go index eade12e5..b217345b 100644 --- a/engine/engine.go +++ b/engine/engine.go @@ -5,6 +5,7 @@ import ( "context" "fmt" "os" + "path/filepath" "regexp" "strconv" "strings" @@ -53,6 +54,7 @@ type ruleEngine struct { codeSnipLimit int contextLines int incidentSelector string + locationPrefixes []string } type Option func(engine *ruleEngine) @@ -81,6 +83,12 @@ func WithIncidentSelector(selector string) Option { } } +func WithLocationPrefixes(location []string) Option { + return func(engine *ruleEngine) { + engine.locationPrefixes = location + } +} + func CreateRuleEngine(ctx context.Context, workers int, log logr.Logger, options ...Option) RuleEngine { // Only allow for 10 rules to be waiting in the buffer at once. // Adding more workers will increase the number of rules running at once. @@ -403,6 +411,31 @@ func processRule(ctx context.Context, rule Rule, ruleCtx ConditionContext, log l } +func (r *ruleEngine) getRelativePathForViolation(fileURI uri.URI) (uri.URI, error) { + var sourceLocation string + if fileURI != "" { + file := fileURI.Filename() + // get the correct source + for _, locationPrefix := range r.locationPrefixes { + if strings.Contains(file, locationPrefix) { + sourceLocation = locationPrefix + break + } + } + absPath, err := filepath.Abs(sourceLocation) + if err != nil { + return fileURI, nil + } + // given a relative path for source + if absPath != sourceLocation { + relPath := filepath.Join(sourceLocation, strings.TrimPrefix(file, absPath)) + newURI := fmt.Sprintf("file:///%s", filepath.Join(strings.TrimPrefix(relPath, "/"))) + return uri.URI(newURI), nil + } + } + return fileURI, nil +} + func (r *ruleEngine) createViolation(ctx context.Context, conditionResponse ConditionResponse, rule Rule) (konveyor.Violation, error) { incidents := []konveyor.Incident{} fileCodeSnipCount := map[string]int{} @@ -420,8 +453,19 @@ func (r *ruleEngine) createViolation(ctx context.Context, conditionResponse Cond if r.incidentLimit != 0 && len(incidents) == r.incidentLimit { break } + trimmedUri, err := r.getRelativePathForViolation(m.FileURI) + if err != nil { + return konveyor.Violation{}, err + } + + for val := range m.Variables { + if val == "file" { + m.Variables["file"] = trimmedUri + } + } + incident := konveyor.Incident{ - URI: m.FileURI, + URI: trimmedUri, LineNumber: m.LineNumber, // This allows us to change m.Variables and it will be set // because it is a pointer.