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

Codemodder can handle non-existent requested codemods #384

Merged
merged 5 commits into from
Mar 19, 2024
Merged

Conversation

clavedeluna
Copy link
Contributor

@clavedeluna clavedeluna commented Mar 16, 2024

Overview

Codemodder now does not stop with an error if you pass in an unknown codemod for include or exclude

Description

  • Behavior up to this point in codmodder is that argparse would check if any of the codemod names you pass in are not know. If any were not known, it would just stop without running any codemods that are known.
  • To correctly handle this new behavior of continuing on if you requested known codemods, I moved all the logic out of the argparse cli section and put it in a more appropriate place, in match_codemods which already does all the include/exclude check logic.
    Now codemodder output will look like this
codemodder tests/samples/ --output here.txt --codemod-include=secured

[startup]
codemodder: python/0.84.1.dev25+g7f5d2ca.d20240313
command: codemodder tests/samples/ --output here.txt --codemod-include=secured
Requested codemod to include'secured' does not exist.
...
...

closes #346

@clavedeluna clavedeluna marked this pull request as ready for review March 18, 2024 11:47
src/codemodder/registry.py Outdated Show resolved Hide resolved
Copy link

sonarcloud bot commented Mar 19, 2024

Quality Gate Passed Quality Gate passed

Issues
2 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@clavedeluna clavedeluna added this pull request to the merge queue Mar 19, 2024
Merged via the queue into main with commit 9ec75cf Mar 19, 2024
12 checks passed
@clavedeluna clavedeluna deleted the cli-update branch March 19, 2024 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Requesting a non-existent codemod should be a warning and not a hard error
3 participants