-
Notifications
You must be signed in to change notification settings - Fork 25
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-1309: Do not allow input and output dirs to be the same for transform rules #73
Conversation
@@ -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 r == w.output { | |||
return fmt.Errorf("input rule directory and output directory must be different") |
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.
question: Will this error be triggered also if the paths are different but just by slashes?
Example:
- input: /path/to/folder/ (Slash at the end)
- output: /path/to/folder (No slash at the end)
Or
- input: /path\to\folder (backslashes)
- output: /path/to/folder
I'm new to Go so I don't know if the paths are being sanitized before this condition.
Thanks!
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.
@abrugaro great point, paths indeed need to be cleaned before comparing, thank you
@eemcmullan need to update line numbers in demo-output because of konveyor/analyzer-lsp@dca2d15 |
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.
Clean paths, and increment line numbers by 1 in demo-output for
kantra/test-data/analysis-output.yaml
Line 1440 in 9e3f539
jni-native-code-00000: |
kantra/test-data/analysis-output.yaml
Line 1472 in 9e3f539
local-storage-00001: |
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 just need DCO
Signed-off-by: Emily McMullan <[email protected]>
Signed-off-by: Emily McMullan <[email protected]>
* 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]>
https://issues.redhat.com/browse/MTA-1309