-
Notifications
You must be signed in to change notification settings - Fork 220
Open
Description
I've been playing around with using libcst to copy (newly added) annotations from base class stubs to subclasses in a large legacy codebase. It's pretty neat!
There are some edge cases in this that I can't handle, and so kick them up to the user with Codemod.warn()
. There is, however a minor UX issue when processing multiple files in one invocation: once I warn()
, the warning persists in the Context
for all subsequent files processed by that instance of the Codemod
, and so I see spurious warnings attached to the wrong filename:
> python3 -m libcst.tool codemod --hide-blacklisted-warnings -x icetray_codemod.ApplyStubsToSubclasses --stubs ../codemod/stubs.pkl --exclude-patterns 'icecube\.gulliver' sim-services
Calculating full-repo metadata...
Executing codemod...
1.82s 6% complete, 27.87s estimated for 46 files to go...Found 1 error (1 fixed, 0 remaining).
Codemodding /Users/jakob/Documents/IceCube/metaprojects/icetray/src/sim-services/python/gcd_validation/gcd_sanity_checker.py
WARNING: Mismatched arguments. icecube.icetray.I3Module.Finish has 1/0/0 pos-only/normal/kw-only params, I3GCDSanityChecker.Finish has 0/2/0
Successfully codemodded /Users/jakob/Documents/IceCube/metaprojects/icetray/src/sim-services/python/gcd_validation/gcd_sanity_checker.py with warnings
Codemodding /Users/jakob/Documents/IceCube/metaprojects/icetray/src/sim-services/python/gcd_validation/hit_generator.py
WARNING: Mismatched arguments. icecube.icetray.I3Module.Finish has 1/0/0 pos-only/normal/kw-only params, I3GCDSanityChecker.Finish has 0/2/0
Successfully codemodded /Users/jakob/Documents/IceCube/metaprojects/icetray/src/sim-services/python/gcd_validation/hit_generator.py with warnings
Codemodding /Users/jakob/Documents/IceCube/metaprojects/icetray/src/sim-services/python/gcd_validation/pe_generator.py
WARNING: Mismatched arguments. icecube.icetray.I3Module.Finish has 1/0/0 pos-only/normal/kw-only params, I3GCDSanityChecker.Finish has 0/2/0
Successfully codemodded /Users/jakob/Documents/IceCube/metaprojects/icetray/src/sim-services/python/gcd_validation/pe_generator.py with warnings
Codemodding /Users/jakob/Documents/IceCube/metaprojects/icetray/src/sim-services/python/label_events/__init__.py
WARNING: Mismatched arguments. icecube.icetray.I3Module.Finish has 1/0/0 pos-only/normal/kw-only params, I3GCDSanityChecker.Finish has 0/2/0
Successfully codemodded /Users/jakob/Documents/IceCube/metaprojects/icetray/src/sim-services/python/label_events/__init__.py with warnings
Finished codemodding 49 files!
- Transformed 31 files successfully.
- Skipped 18 files.
- Failed to codemod 0 files.
- 4 warnings were generated.
Is this the expected behavior?
Metadata
Metadata
Assignees
Labels
No labels