-
Notifications
You must be signed in to change notification settings - Fork 997
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
Fixing parsing import alias issue #2455
Conversation
Bumps [undici](https://github.com/nodejs/undici) from 5.21.0 to 5.28.4. - [Release notes](https://github.com/nodejs/undici/releases) - [Commits](nodejs/undici@v5.21.0...v5.28.4) --- updated-dependencies: - dependency-name: undici dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]>
Important Auto Review SkippedReview was skipped due to path filters Files ignored due to path filters (1)
You can disable this status message by setting the WalkthroughThe update introduces logic to handle contract name resolution in the Changes
Possibly related issues
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (invoked as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
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.
Actionable comments posted: 1
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- slither/solc_parsing/expressions/expression_parsing.py (1 hunks)
Additional Context Used
GitHub Check Runs (1)
Lint Code Base failure (1)
slither/solc_parsing/expressions/expression_parsing.py: [warning] 525-525:
C0303: Trailing whitespace (trailing-whitespace)
|
||
pattern = r'\b(\w+)\s*\)' | ||
|
||
type_string = expression["typeDescriptions"]["typeString"] | ||
|
||
type_string_name = re.search(pattern, type_string) | ||
|
||
if type_string_name: | ||
found_contract = type_string_name.group(1) | ||
all_contracts_dict = {c.name: c for c in caller_context.compilation_unit.contracts} | ||
|
||
if str(var) in all_contracts_dict.keys() and found_contract in all_contracts_dict.keys(): | ||
if str(var) != found_contract: | ||
var = all_contracts_dict[found_contract] | ||
|
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.
Resolve contract names correctly in import aliases.
- if was_created:
- var.set_offset(src, caller_context.compilation_unit)
-
- identifier = Identifier(var)
- identifier.set_offset(src, caller_context.compilation_unit)
- var.references.append(identifier.source_mapping)
-
- return identifier
+ if was_created:
+ var.set_offset(src, caller_context.compilation_unit)
+
+ identifier = Identifier(var)
+ identifier.set_offset(src, caller_context.compilation_unit)
+ var.references.append(identifier.source_mapping)
+
+ return identifier
Please remove the trailing whitespace on line 525 as it is a minor style issue but important for maintaining clean code.
Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.
pattern = r'\b(\w+)\s*\)' | |
type_string = expression["typeDescriptions"]["typeString"] | |
type_string_name = re.search(pattern, type_string) | |
if type_string_name: | |
found_contract = type_string_name.group(1) | |
all_contracts_dict = {c.name: c for c in caller_context.compilation_unit.contracts} | |
if str(var) in all_contracts_dict.keys() and found_contract in all_contracts_dict.keys(): | |
if str(var) != found_contract: | |
var = all_contracts_dict[found_contract] | |
pattern = r'\b(\w+)\s*\)' | |
type_string = expression["typeDescriptions"]["typeString"] | |
type_string_name = re.search(pattern, type_string) | |
if type_string_name: | |
found_contract = type_string_name.group(1) | |
all_contracts_dict = {c.name: c for c in caller_context.compilation_unit.contracts} | |
if str(var) in all_contracts_dict.keys() and found_contract in all_contracts_dict.keys(): | |
if str(var) != found_contract: | |
var = all_contracts_dict[found_contract] | |
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- slither/solc_parsing/expressions/expression_parsing.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- slither/solc_parsing/expressions/expression_parsing.py
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.
Actionable comments posted: 0
Review Details
Configuration used: CodeRabbit UI
Review profile: CHILL
Files selected for processing (1)
- slither/solc_parsing/expressions/expression_parsing.py (1 hunks)
Files skipped from review as they are similar to previous changes (1)
- slither/solc_parsing/expressions/expression_parsing.py
…e2e/compilation/test_data/test_node_modules/undici-5.28.4 Bump undici from 5.21.0 to 5.28.4 in /tests/e2e/compilation/test_data/test_node_modules
Thanks for the PR! I found the root cause and fixed it in #2459 |
Fixing the issue explained in: https://github.com/crytic/slither/issues/2454
Summary by CodeRabbit