sourcery
sourcery copied to clipboard
VSCode reports suggestions the CLI doesn't report
Checklist
- [x] I have searched the Sourcery documentation for the issue, and found nothing
- [x] I have checked there are no open bugs referencing the same bug or problem
Description
I have installed the Sourcery plugin for VS Code. Furthermore I have set up the Sourcery CLI. Both of them are configured to use the same .sourcery.yaml config file.
Now VS Code reports some suggestions that the CLI does not report, e.g. the use-contextlib-suppress suggestion:
Even when I explicitly enable it on the command line, the CLI does not find any issues:
The same happens with extract-method and extract-duplicate-method.
Where does the difference in behavior come from? How can I configure VS Code and the CLI to report the same suggestions?
Code snippet that reproduces issue
#!/usr/bin/env python3
def main():
try:
invalid = 1 / 0
except ZeroDivisionError:
pass
if __name__ == "__main__":
main()
Debug Information
IDE Version: VSCode 1.81.1
Sourcery Version: Sourcery 1.6.0
Operating system and Version: Ubuntu 22.04 via WSL
Hello, @carlfriedrich! Thanks for reporting this issue.
This is a known limitation in the Sourcery CLI - it cannot yet handle refactorings that add imports. The same limitation applies to both extract-method and extract-duplicate-method, as you mentioned. Enhancing the CLI to have those capabilities is already on our roadmap but may still take some time to be implemented.
@ruancomelli Thanks for your quick reply. Looking forward to the implementation.