Skip to content

Commit

Permalink
Fast-forward release 0.3 (#82)
Browse files Browse the repository at this point in the history
* MTA-1309: Do not allow input and output dirs to be the same for transform rules (#73)

* do not allow input and output dirs to be the same for transform

Signed-off-by: Emily McMullan <[email protected]>

* update filepath clean and test output

Signed-off-by: Emily McMullan <[email protected]>

---------

Signed-off-by: Emily McMullan <[email protected]>

* display link to static report (#80)

Signed-off-by: Emily McMullan <[email protected]>

---------

Signed-off-by: Emily McMullan <[email protected]>
Co-authored-by: Emily McMullan <[email protected]>
  • Loading branch information
pranavgaikwad and eemcmullan authored Oct 6, 2023
1 parent 9e3f539 commit 0bba1f6
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 3 deletions.
4 changes: 4 additions & 0 deletions cmd/analyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/konveyor/analyzer-lsp/engine"
outputv1 "github.com/konveyor/analyzer-lsp/output/v1/konveyor"
"github.com/konveyor/analyzer-lsp/provider"
"go.lsp.dev/uri"
"gopkg.in/yaml.v2"

"github.com/spf13/cobra"
Expand Down Expand Up @@ -678,6 +679,9 @@ func (a *analyzeCommand) GenerateStaticReport(ctx context.Context) error {
if err != nil {
return err
}
uri := uri.File(filepath.Join(a.output, "static-report", "index.html"))
cleanedURI := filepath.Clean(string(uri))
a.log.Info("Static report created. Access it at this URL:", "URL", cleanedURI)

return nil
}
Expand Down
5 changes: 5 additions & 0 deletions cmd/shimconvert.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ func (w *windupShimCommand) Validate() error {
if w.input == nil || len(w.input) == 0 {
return fmt.Errorf("input for rule file or directory must not be empty")
}
for _, r := range w.input {
if filepath.Clean(r) == filepath.Clean(w.output) {
return fmt.Errorf("input rule directory and output directory must be different")
}
}
// try to get abs path, if not, continue with relative path
if absPath, err := filepath.Abs(w.output); err == nil {
w.output = absPath
Expand Down
6 changes: 3 additions & 3 deletions test-data/analysis-output.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1450,15 +1450,15 @@
- uri: file:///root/.m2/repository/io/konveyor/demo/config-utils/1.0.0/io/konveyor/demo/config/ApplicationConfiguration.java
message: Java native libraries might not run in a cloud or container environment.. Recommendations. * Review the purpose of the native library in your application.. * Check whether the native library is compatible with a cloud environment.. * Reuse or embed the native library or application in a cloud environment, for example, in a JBoss module.. * Replace, remove, or rewrite the native library or application using a cloud-compatible equivalent.
codeSnip: " 1 package io.konveyor.demo.config;\n 2 \n 3 import java.io.FileInputStream;\n 4 import java.io.InputStream;\n 5 import java.util.Properties;\n 6 \n 7 public class ApplicationConfiguration {\n 8 \n 9 \tprivate Properties config;\n 10 \n 11 \tpublic ApplicationConfiguration() {\n 12 \t\tsuper();\n 13 \t\tthis.config = loadProperties();\n 14 \n 15 \t}\n 16 \n 17 \tprivate Properties loadProperties() {\n 18 \t\tProperties properties = new Properties();\n 19 \n 20 \t\ttry (InputStream inputStream = new FileInputStream(\"/opt/config/persistence.properties\")) {\n 21 \n 22 \t\t\tproperties.load(inputStream);\n 23 \n 24 \t\t} catch (Exception e) {\n 25 \t\t\tSystem.out.println(\"Exception: \" + e);\n 26 \t\t}\n 27 \n 28 \t\treturn properties;\n 29 \t}\n 30 \n 31 \tpublic String getProperty (String name) {\n 32 \t\treturn config.getProperty(name);\n 33 \t}\n 34 \n 35 \n 36 \n 37 }\n"
lineNumber: 12
lineNumber: 13
variables:
file: file:///root/.m2/repository/io/konveyor/demo/config-utils/1.0.0/io/konveyor/demo/config/ApplicationConfiguration.java
kind: Constructor
name: ApplicationConfiguration
- uri: file:///root/.m2/repository/io/konveyor/demo/config-utils/1.0.0/io/konveyor/demo/config/ApplicationConfiguration.java
message: Java native libraries might not run in a cloud or container environment.. Recommendations. * Review the purpose of the native library in your application.. * Check whether the native library is compatible with a cloud environment.. * Reuse or embed the native library or application in a cloud environment, for example, in a JBoss module.. * Replace, remove, or rewrite the native library or application using a cloud-compatible equivalent.
codeSnip: " 1 package io.konveyor.demo.config;\n 2 \n 3 import java.io.FileInputStream;\n 4 import java.io.InputStream;\n 5 import java.util.Properties;\n 6 \n 7 public class ApplicationConfiguration {\n 8 \n 9 \tprivate Properties config;\n 10 \n 11 \tpublic ApplicationConfiguration() {\n 12 \t\tsuper();\n 13 \t\tthis.config = loadProperties();\n 14 \n 15 \t}\n 16 \n 17 \tprivate Properties loadProperties() {\n 18 \t\tProperties properties = new Properties();\n 19 \n 20 \t\ttry (InputStream inputStream = new FileInputStream(\"/opt/config/persistence.properties\")) {\n 21 \n 22 \t\t\tproperties.load(inputStream);\n 23 \n 24 \t\t} catch (Exception e) {\n 25 \t\t\tSystem.out.println(\"Exception: \" + e);\n 26 \t\t}\n 27 \n 28 \t\treturn properties;\n 29 \t}\n 30 \n 31 \tpublic String getProperty (String name) {\n 32 \t\treturn config.getProperty(name);\n 33 \t}\n 34 \n 35 \n 36 \n 37 }\n"
lineNumber: 21
lineNumber: 22
variables:
file: file:///root/.m2/repository/io/konveyor/demo/config-utils/1.0.0/io/konveyor/demo/config/ApplicationConfiguration.java
kind: Method
Expand All @@ -1482,7 +1482,7 @@
- uri: file:///root/.m2/repository/io/konveyor/demo/config-utils/1.0.0/io/konveyor/demo/config/ApplicationConfiguration.java
message: 'An application running inside a container could lose access to a file in local storage.. Recommendations. The following recommendations depend on the function of the file in local storage:. * Logging: Log to standard output and use a centralized log collector to analyze the logs.. * Caching: Use a cache backing service.. * Configuration: Store configuration settings in environment variables so that they can be updated without code changes.. * Data storage: Use a database backing service for relational data or use a persistent data storage system.. * Temporary data storage: Use the file system of a running container as a brief, single-transaction cache.'
codeSnip: " 1 package io.konveyor.demo.config;\n 2 \n 3 import java.io.FileInputStream;\n 4 import java.io.InputStream;\n 5 import java.util.Properties;\n 6 \n 7 public class ApplicationConfiguration {\n 8 \n 9 \tprivate Properties config;\n 10 \n 11 \tpublic ApplicationConfiguration() {\n 12 \t\tsuper();\n 13 \t\tthis.config = loadProperties();\n 14 \n 15 \t}\n 16 \n 17 \tprivate Properties loadProperties() {\n 18 \t\tProperties properties = new Properties();\n 19 \n 20 \t\ttry (InputStream inputStream = new FileInputStream(\"/opt/config/persistence.properties\")) {\n 21 \n 22 \t\t\tproperties.load(inputStream);\n 23 \n 24 \t\t} catch (Exception e) {\n 25 \t\t\tSystem.out.println(\"Exception: \" + e);\n 26 \t\t}\n 27 \n 28 \t\treturn properties;\n 29 \t}\n 30 \n 31 \tpublic String getProperty (String name) {\n 32 \t\treturn config.getProperty(name);\n 33 \t}\n 34 \n 35 \n 36 \n 37 }\n"
lineNumber: 19
lineNumber: 20
variables:
file: file:///root/.m2/repository/io/konveyor/demo/config-utils/1.0.0/io/konveyor/demo/config/ApplicationConfiguration.java
kind: Constructor
Expand Down

0 comments on commit 0bba1f6

Please sign in to comment.