-
Notifications
You must be signed in to change notification settings - Fork 2
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
Anonymize config output #625
Conversation
Add .config.projectDir so we can always access it without always having to pass the path as an argument to functions Set .config.projectDir to @internalFunctionality so it's never outputted (would defeat the whole purpose) This could potentially clean up more code, but this is not done yet What if there is no projectDir set (no viash project file found). We'll still be outputting full paths!
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #625 +/- ##
===========================================
+ Coverage 92.39% 92.42% +0.03%
===========================================
Files 128 128
Lines 3865 3881 +16
Branches 623 634 +11
===========================================
+ Hits 3571 3587 +16
Misses 294 294 ☔ View full report in Codecov by Sentry. |
…y anonymize the path except for the last path section
info: Option[Info] = None, | ||
|
||
@internalFunctionality | ||
projectDir: Option[String] = None, |
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.
This should probably be removed, and we should be using the projectConfig.rootDir (or a renamed version thereof) instead, right?
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.
Absolutely! The base didn't have the ProjectConfig in the (component) config yet. Fixed by merging develop into the branch (together with some other functionality fixes)
6cf03ac
to
7ece030
Compare
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.
Suggestions LGTM!
Minor question about the test :)
test("anonymizePath with a common path and a trailing slash") { | ||
val basePath = Some(Paths.get("/foo/bar")) | ||
val path = "/foo/bar/baz/test.txt" | ||
val result = IO.anonymizePath(basePath, path) | ||
assert(result == "baz/test.txt") | ||
} |
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.
There is no trailing slash in this example, or am I mistaken?
test("anonymizePath with a common path and a trailing slash") { | |
val basePath = Some(Paths.get("/foo/bar")) | |
val path = "/foo/bar/baz/test.txt" | |
val result = IO.anonymizePath(basePath, path) | |
assert(result == "baz/test.txt") | |
} | |
test("anonymizePath with a common path and a trailing slash") { | |
val basePath = Some(Paths.get("/foo/bar/")) | |
val path = "/foo/bar/baz/test.txt" | |
val result = IO.anonymizePath(basePath, path) | |
assert(result == "baz/test.txt") | |
} |
Or
test("anonymizePath with a common path and a trailing slash") { | |
val basePath = Some(Paths.get("/foo/bar")) | |
val path = "/foo/bar/baz/test.txt" | |
val result = IO.anonymizePath(basePath, path) | |
assert(result == "baz/test.txt") | |
} | |
test("anonymizePath with a common path and a trailing slash") { | |
val basePath = Some(Paths.get("/foo/bar")) | |
val path = "/foo/bar/baz/test_folder/" | |
val result = IO.anonymizePath(basePath, path) | |
assert(result == "baz/test_folder/") | |
} |
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.
Thanks for spotting that! A refactor went wrong. 😛
Describe your changes
Anonymize configs before outputting them, either to console or file
Add .config.projectDir so we can always access it without always having to pass the path as an argument to functions
Set .config.projectDir to @internalFunctionality so it's never outputted (would defeat the whole purpose)
This could potentially clean up more code, but this is not done yet
What if there is no projectDir set (no viash project file found). We'll still be outputting full paths!
Related issue(s)
Closes #20
Type of Change
Checklist
Requirements:
Tests:
Documentation:
Test Environment