Skip to main content

Statically check your Python code

Project description

py_static_check

py_static_check can statically check your Python code for a lot of common errors. It uses a modified pyflakes code and extends with following things:

  • Ability to specify what star imports resolve to (-s argument)

  • Ability to ignore unused import warnings (-i argument)

  • Better sorting of warnings/errors

For more information check out:

To install it do following:

sudo easy_install py_static_check

Here are some of the things py_static_check can do.

Catch undefined names, even for star imports

Example code:

from os import *

def function_with_error():
    print path
    print paths

star_imports.py:

import os
STAR_IMPORTS = {
    'os': os.__all__,
}

When ran with py_static_check:

$ py_static_check -s tests/star_import.py tests/undefined_name_star.py
tests/undefined_name.py:5: undefined name 'paths

Ignore not used warnings

Exampel code:

from os import path

When ran with py_static_check -i option:

$ py_static_check -i tests/ignore_not_used.py

$ py_static_check tests/ignore_not_used.py
tests/ignore_not_used.py:10: 'path' imported but unused

Assigned but never used

Like pyflakes it can catch a lot of errors, such as defining a variable without using it.

Exampel code:

def some_function():
    def inner_fn():
        local_var = ""

When ran with py_static_check:

$ py_static_check tests/assigned_but_never_used.py

tests/assigned_but_never_used.py:8: local variable 'local_var' is assigned to but never used

Copyright: 2011 by amix License: MIT.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

py_static_check-1.0.tar.gz (10.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

py_static_check-1.0-py2.7.egg (24.4 kB view details)

Uploaded Egg

File details

Details for the file py_static_check-1.0.tar.gz.

File metadata

  • Download URL: py_static_check-1.0.tar.gz
  • Upload date:
  • Size: 10.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for py_static_check-1.0.tar.gz
Algorithm Hash digest
SHA256 bb0410dcd604a871fb95d2770888ea8221c1772e4d9528ad72974627d48322f3
MD5 b77d61ea007ab33b7f3c52dd693fc121
BLAKE2b-256 795fd608bccc387c667d5044b669888b700b11fb9f1f2f348e46fecc01b1b157

See more details on using hashes here.

File details

Details for the file py_static_check-1.0-py2.7.egg.

File metadata

File hashes

Hashes for py_static_check-1.0-py2.7.egg
Algorithm Hash digest
SHA256 0aa1ea8de2f8c4a94660f631ddab09e04d5b90c28b32c100d4bd63682f42a92c
MD5 ffb42a19194f39d906df9cc43cf28a65
BLAKE2b-256 8bf8e861f171372dc349e7ddfcbf1adb85470d4f56b86153294d88fe529f9223

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page