Linting in Visual Studio Code for Python Turtle graphics

Apr 27 2018

The built-in linter doesn’t do well with turtle. You can choose a different linter like flake8. However, you’ll trade off one annoying thing for a different annoying thing. Choose your poison.

  • Open the command palette (⌘ + Shift + P)
  • Select “Python: Select Linter”
  • Choose “flake8”
  • If you’ve never used that before, you’ll be prompted to install it with a prompt similar to this

linter_install_prompt

  • Do that and restart VS Code
  • Now you can get the red squiggles to go away on the turtle function names by explicitly naming them in multiple import statements (this is the annoying thing about the fix).

turtle_code_without_squiggles

  • To switch back to the default linter, choose “Python: Select Linter” again and choose “pylint”

Resources:
https://github.com/Microsoft/vscode-python/issues/1056
https://code.visualstudio.com/docs/python/linting

No responses yet