Simplify removing leading and trailing separators#712
Conversation
Previously, we checked if the leading or trailing character was a colon and then used a wildcard to remove it. It is simpler to just remove a leading or trailing colon. This has the added benefit of only using shell built-in functions. Co-authored-by: Scott K Logan <logans@cottsay.net>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #712 +/- ##
=======================================
Coverage 86.98% 86.98%
=======================================
Files 69 69
Lines 4088 4088
Branches 706 706
=======================================
Hits 3556 3556
Misses 421 421
Partials 111 111 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
cba4e28 to
e31f37f
Compare
|
So this is sort of interesting, because I uncovered some issues in #713 that are solved by this PR, but not because of the lack of It doesn't actually fail, it just doesn't remove the leading/trailing separators like it should. Given that there's actually buggy behavior on a supported platform, I'm a little more motivated to get this pushed through and get #713 merged with some actual tests here. |
knmcguire
left a comment
There was a problem hiding this comment.
I've tested out these solutions directly in a bash terminal and I can confirm this working.
Just a comment that it won't remove any double colons before and after the environment variable path string, nor does it remove any double colons in between. But I've learned that this is not really an edge case that has happened before, if at least nobody has reported this at least...
Agreed on all points. The primary purpose for this is to ensure we aren't making things worse. |
This change is adapted from ament/ament_package#152, authored by @robwoolley.
Requires tests that are added in #713.