Fix duplicate path fragments from PathCleaner.clean #2150
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The PathCleaner generates path fragments according to the ruby constants. This works by splitting the uri path provided by ruby into class parts. When handling nested constants, the default class part list contains all constant fragments from the constant name except the last one.
We need to do this because the ruby docs sometimes do not include the parent class parts in the uri path. However sometimes they do include those parent class parts.
This led to class parts being duplicated in the cleaned path. One example of this is
Thread::Queue#deq
. The alias method path provided by ruby is "Thread/Queue" and the constant is "Thread::Queue". When cleaning the path we default to['Thread']
and join "Thread" and "Queue" afterwards, resulting in the paththread/thread/queue
which is not valid.This patch tries to fix this by only adding new class parts if the new part does not already exist in the list of class parts.
Fixes #1748