Giter Club home page Giter Club logo

codacy-hack's Introduction

codacy-hack

Codacy Badge

Trying (unsuccessfully) to find Python syntax errors and undefined names using Codacy...

See: codacy_hack.py for examples.

Codacy runs PyLint so we already have a linter in place.

The ideal linter in a dynamic language should flag issues that the compiler would flag in a compiled language.

The linter should raise an alert if there is a syntax error or if an import is missing just like a compiler would. It should warn you that basestring, cmp(), long, reload(), unicode, xrange() are not builtins in Python 3.

Codacy does none of these things that a compiler would. It merely says that async def func(): is not valid Python. (Argh!?!) It seems to be tuned to Python 2 and is therefor more legacy than the PyLint that it is based on. In the hands of a strong practitioner, PyLint can catch many of the issues mentioned above but it requires configuration and usually a lot of # pylint: disable=xyz directives in your code.

I prefer flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics to catch the syntax errors and undefined names that Codacy does not.


Add flake8 tests to find Python syntax errors and undefined names.

E901,E999,F821,F822,F823 are the "showstopper" flake8 issues that can halt the runtime with a SyntaxError, NameError, etc. Most other flake8 issues are merely "style violations" -- useful for readability but they do not effect runtime safety.

  • F821: undefined name name
  • F822: undefined name name in __all__
  • F823: local variable name referenced before assignment
  • E901: SyntaxError or IndentationError
  • E999: SyntaxError -- failed to compile a file into an Abstract Syntax Tree

codacy-hack's People

Contributors

codacy-badger avatar

Watchers

James Cloos avatar Christian Clauss avatar  avatar

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.