check-endpoints.py: Updating regex to treat search items as distinct path. #17
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.
Fixes #10
Issue was a result of how the regex search is being performed. It searches for each item without the leading '/', and it doesn't search in the context of the item being used as an exact path.
So "/oauth" becomes "oauth" - which exists as a string on its own elsewhere in clients.py. "/api/token" becomes "api/token", which has a child ("api/token/test") in clients.py, which is being counted as a match because the string "api/token" can be found in the string "api/token/test").
I fixed this (kinda hacky) by adding a " (double quote) to the end of the string the regex searches for, so the examples above will now search for oauth**"** and api/token/test**"** - which do not exist on their own as distinct path = " items.
A better fix would be to search for the string in leading and trailing double-quotes, or even force compliance that all paths have to take the format path = "" - however, some paths in clients.py have been entered with a leading "/" (path = "/api/rel/following" is an example), and 1) adding logic to account for this would add more complexity, and 2) I'd rather not edit clients.py to force that compliance because I'm concerned about breaking something.