-
Notifications
You must be signed in to change notification settings - Fork 195
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
Compatibility to BrianHenryIE/strauss #113
Conversation
fix: compatibility to BrianHenryIE/strauss
👋 Hi @swarnat, Thank you for contributing to Wikimedia! This Github repository is a read-only mirror. If you are interested in sticking around within the Wikimedia community, please take a look at https://www.mediawiki.org/wiki/New_Developers |
fix: prevent prefixing the string to replace
I suggest to, instead of detecting a (generally non-existent) prefix, to focus only on extracting the suffix after "Less_Tree_". I prefer to 1) avoid encoding an assumption between Visitor and Tree, and 2) not support or maintain extra code for something we can't easily test for and would never happen outside of the code modification scenario, as such code is likely to seem as "unused code" and be break or be removed in the future by accident. OptionalAnythingLess_Tree_Foo_Bar > Foo_Bar > FooBar Changing the transform from prefix to suffix means:
|
This comment was marked as duplicate.
This comment was marked as duplicate.
I would agree with you, because to do a simple str_replace sounds a little bit unsecure in my case. But yeah, because the "Less_Tree" must removed, I can also split by that string and take the last element. I already moved the diff to gerrit, because the bot don't like that here. :) |
Thanks @swarnat. I left a suggestion there. |
fix: compatibility to BrianHenryIE/strauss
This is a very special modification for only some users, but which are currently impossible to use this helpfull library
BrianHenryIE/strauss library will prefix dependency classnames with a custom string to prevent dependency collision.
For example classname will be changed from Less_Visitor to ModA_Less_Visitor.
So multiple versions of same library can be used in ecosystems, where external modules can be installed from different developers.
The modified line generate function calls from class names, by removing the "namespace" part of class name.
When there is a custom prefix, then this line is not working.
The small modification check for custom prefix and append them to classname replacement.
Not a perfect solution. Maybe there is a better one.