-
-
Notifications
You must be signed in to change notification settings - Fork 23
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
feat: pm refactor #158
base: main
Are you sure you want to change the base?
feat: pm refactor #158
Conversation
note: this was already protected from partial matches eclipsing full matches. the reason I'm adding this further check is in preparation of enriching the console error communication to distinguish between missing remapping and missing file. Currently it results in a nonsense path that doesn't get caught until attempted compile |
@@ -207,7 +207,8 @@ def _resolve_import_remapping(self, project: "ProjectManager"): | |||
# Get all matches. | |||
valid_matches: list[tuple[str, str]] = [] | |||
for check_remap_key, check_remap_value in import_remapping.items(): | |||
if check_remap_key not in self.value: | |||
# Match with a trailing slash to avoid partial matches. | |||
if f"{check_remap_key}/" not in self.value: |
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.
What if it already ends with a trailing slash?
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.
I'm open to being convinced otherwise but then I'd say they're just doing it wrong. I only ever really encounter trailing slashes as a thing in web URLs, for instance if someone is making a git branch you wouldn't expect them to specify it as "feat/pm-refactor/"
But more validation never hurts, I can add a line to protect against this
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.
remap/key/=value/key/
doesnt seem too far-fetched or invaliud. It seems worth just doing:
key_to_check = check_remap_key if check_remap_key.endswith("/") else f"{check_remap_key}/"
i key_to_check not in self.value:
What I did
fixes: #
How I did it
How to verify it
Checklist