You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adding imports with LibCST is a sticky subject because they are normal statements mixed inside Module.body. It's not currently possible to do a simple addition with LibCST alongside other changes because that would require replacing the entire root Module object with one that contains the new statements, nullifying any other transforms that happened during linting.
Consider offering a mechanism to include any desired additional imports with each reported violation, and then trigger AddImportsVisitor after applying any other autofixes, so that all imports are added at once, and can operate on the already-fixed module object.
The text was updated successfully, but these errors were encountered:
Adding imports with LibCST is a sticky subject because they are normal statements mixed inside
Module.body
. It's not currently possible to do a simple addition with LibCST alongside other changes because that would require replacing the entire rootModule
object with one that contains the new statements, nullifying any other transforms that happened during linting.Consider offering a mechanism to include any desired additional imports with each reported violation, and then trigger AddImportsVisitor after applying any other autofixes, so that all imports are added at once, and can operate on the already-fixed module object.
The text was updated successfully, but these errors were encountered: