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

[Call-by-name] semgrep/trufflehog/yamllint migration #21149

Merged
merged 8 commits into from
Jul 9, 2024

Conversation

sureshjoshi
Copy link
Member

This is a PR for the call-by-name migration on multiple, smaller, experimental backends. SemGrep, TruffleHog, YamlLint

Tested on https://github.com/sureshjoshi/pantsanity (as much as reasonably possible) via pants sanity ::

See issue #21065 for tracking list.

@sureshjoshi sureshjoshi added the category:internal CI, fixes for not-yet-released features, etc. label Jul 9, 2024
@@ -556,20 +567,89 @@ def map_dict_form_get_to_new_syntax(
# ------------------------------------------------------------------------------------------


def remove_unused_implicitly(call: cst.Call, called_func: cst.FunctionDef) -> cst.Call:
def fix_implicitly_usage(call: cst.Call, target_func: cst.FunctionDef) -> cst.Call:
Copy link
Member Author

Choose a reason for hiding this comment

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

Reviewers can largely ignore this function - it's getting updated, modified, and re-factored basically every new migration to handle missing implicitly cases - and once those cases are stable and tested, I will re-factor this and also extract it to a separate fixer.

Only committing here in the event anyone else wants to run migration, this version better handles implicitly cleanup.

The tests in migrate_call_by_name_tests.py are likely more interesting.

@sureshjoshi
Copy link
Member Author

Of note: This was the first PR that I didn't manually do any implicitly clean up upon, so I feel like the implicitly fixer is slowly converging.

But the fixer explicitly does not handle certain cases (e.g. more complicated dictionaries) because they're currently rare, those cases can be fixed by hand very quickly, and I'm trying to focus more time on getting the codebase migrated vs perfecting all the fixer use cases.

The latter is more important when the migration goal is opened up to in-repo plugins, where we want to be as seamless as possible

@sureshjoshi sureshjoshi merged commit 00a0bd7 into pantsbuild:main Jul 9, 2024
25 checks passed
@sureshjoshi sureshjoshi deleted the call-by-name-exp-tools branch July 9, 2024 17:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:internal CI, fixes for not-yet-released features, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants