Sunday, November 10, 2019

How The ISE team at Stack Overflow does Python Linting


Some time back I wrote this short guide for our internal wiki at Stack.
I'm sharing it here for anyone with an interest in Python linting.
Our team generally subscribes to a modified version of pep8.
Reference: Google Standards for Python

Specifically:
  • We allow long lines up to 120 characters.
  • Classes should be CamelCase
  • Globals FULLY_CAPITALIZED
  • All other variables lower_snake_case
The following are recommended steps using Sublime Text linting with Anaconda.
  1. Install sublime text Package Control
    • From inside sublime text:
    • CTRL + SHIFT + P to open the package control menu 
  2. Install anaconda
    • if you already have it you may need to reinstall anaconda when done
  3. Install Sublime Text Package Resource Viewer 
  4. Update Anaconda Settings
    1. Go to preferences -> Package Settings -> Anaconda
    2. paste anaconda settings into the user settings file 
  5. Using Package resource viewer open your current color scheme 
    1. CTRL + Shift + P - then type color scheme 
    2. Select The Package Resource Viewer option for your color scheme.
    3. Add the color scheme JSON into the Rules section of your color scheme. 
    4. You'll need to do this any time you switch to another color scheme.
If everything worked out, your editor should now look something like this:
(Yellow dots indicate warnings, Red errors, blue spacing mistakes.)
An explanation of the error will appear in the bottom of the editor

No comments:

Post a Comment