Giter VIP home page Giter VIP logo

pythonchecker's Introduction

Python Checker

A maintainable Python code checker for Sublime Text 3

Screenshot

Once the plugin is installed, it will highlight common problems in your Python code.

Internally it relies on the wonderful pyflakes and pep8 packages.

Installation

Use Package Control.

Python version

By default Python Checker will use the version of Python that came with Sublime Text 3. This currently means Python 3 and can result in problems like undefined name 'unicode' being reported. If you want to use a different version, set the python_interpreter_path option in your project settings:

# <project name>.sublime-project
{
    "settings": {
        "python_interpreter_path": "/usr/bin/python"
    }
}

This is compatible with other plugins including SublimeJEDI.

PEP8 checks

Use the standard pep8 configuration files to control the behaviour including skipping some checks. An example project configration might look like this:

# setup.cfg or tox.ini
[pep8]
ignore = E501,W191
max-line-length = 120

pythonchecker's People

Contributors

patrys avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

pythonchecker's Issues

Attribute called "None" is misinterpreted to be a syntax error

If I have a class whose instances have an attribute called None (don't ask, not a class I've made) like so:

class X:
    def __init__(self):
        self.None = True

Python Checker will say "invalid syntax" while it's actually proper code, just not recommended.

Same will happen if I access it through an instance:

x = X()
print(x.None)

KeyError while highlighting problems

It doesn't happen every time. I'm not sure yet how to re-create it.

Writing file /home/szuliq/source//views.py with encoding UTF-8 (atomic)
Traceback (most recent call last):
  File "/opt/sublime_text/sublime_plugin.py", line 263, in on_post_save_async
    callback.on_post_save_async(v)
  File "plugin in /home/szuliq/.config/sublime-text-3/Installed Packages/Python Checker.sublime-package", line 28, in on_post_save_async
  File "plugin in /home/szuliq/.config/sublime-text-3/Installed Packages/Python Checker.sublime-package", line 65, in revalidate
  File "plugin in /home/szuliq/.config/sublime-text-3/Installed Packages/Python Checker.sublime-package", line 86, in highlight_problems
KeyError: 110

Check as you type

If we get async checking (issue #3), we can use a timer to re-check the source when the user pauses typing.

Async checking

subprocess.check_output() stalls the host process. It would also be nice to be able to cancel the check and kill the process.

Manual Installation

Is there any way I can install your plugin manually?
I can't make Package Control to show up in Command Pallet no matter what I try including removing it from "ignored_packages" list

Question: pep8 settings get ignored & pyflake errors won't show up.

I just installed PythonChecker under a fresh Sublime 3 install trough Packet Control.

Using pep8 and pyflakes standalone works as expected.

I store my configuration (mainly some ignores) under ~/.config/pep8.

When I manually (command line) check with pep8 I get no errors and 2 with pyflakes (I intentionally mistyped one import). Opening the source in Sublime, I get a lot of pep8 errors and no pyflakes errors.

undefined name - unicode

The unicode type considered is undefined.
This code produces and error:
x = unicode('abcd').encode('utf8')

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.