Skip to content
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

chore: Fix for Incorrect Object Passing and Loop Control #5822

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions scripts/fix-unreachable-pub.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ def main():

# Don't modify code that is not in the current workspace
if str(Path.cwd()) not in str(warning['target']['src_path']):
return
continue # Use continue instead of return to process other warnings
Copy link
Member

@jxs jxs Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You referred that:

The script was using return to exit the loop when the code wasn't in the current workspace. I replaced it with continue to ensure the loop processes all warnings as intended.

but as the comment above states, we do not want to modify code that is not in the current workspace, the function is called for every path that is outputted by clippy, so I think we should just return if the path is not part of the current workspace, no?


m = warning["message"]

Expand All @@ -61,7 +61,7 @@ def main():
if code is None:
continue

fix_unreachable_pub_warning(m)
fix_unreachable_pub_warning(warning) # Pass the entire warning object, not just m
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you elaborate give an example of the unexpected behavior you were presented?



if __name__ == "__main__":
Expand Down
Loading