Skip to main content

yet another static checker for Python code

Project description

Overview

pydiatra is yet another static checker for Python code.

Implemented checks

  • embedded code copies

  • except shadowing builtins (e.g. except IOError, OSError:, which overwrites OSError)

  • bare except (i.e. except:)

  • hardcoded errno values (e.g. exc.errno == 2 instead of exc.errno == errno.ENOENT)

  • inconsistent use of tabs and spaces in indentation

  • mkstemp() file descriptor leaks (e.g. path = tempfile.mkstemp()[1])

  • obsolete PIL imports (e.g. import Image instead of from PIL import Image)

  • regular expression syntax errors

  • misplaced flags arguments in re.split(), re.sub(), re.subn()

  • dubious or deprecated constructs in regular expressions:

    • duplicate range (e.g. re.compile("[aa]"))

    • overlapping ranges (e.g. re.compile("[a-zA-z]"))

    • bad escape sequences (e.g. re.compile(r"\eggs"))

    • misplaced inline flags (e.g. re.compile("eggs(?i)"); Python 3.6+ only)

    • combining incompatible flags

    • redundant flags

  • string exceptions (e.g. raise "eggs" or except "ham":)

  • string formatting errors

  • comparisons with sys.version or sys.hexversion

  • Python syntax errors

  • Python syntax warnings

    • assertions that are always true

    • syntactic constructs that are no longer supported in Python 3

    • ill-formed assignments to global variables

    • use of async and await as names

    • invalid escape sequences in strings (Python 3.6+ only)

See the manual page for details.

Prerequisites

  • Python 2.6+ or 3.2+

  • argparse (needed only for Python 2.6)

  • futures (needed only for Python 2.X)

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

pydiatra-0.12.7.tar.gz (45.7 kB view details)

Uploaded Source

File details

Details for the file pydiatra-0.12.7.tar.gz.

File metadata

  • Download URL: pydiatra-0.12.7.tar.gz
  • Upload date:
  • Size: 45.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: Python-urllib/2.7

File hashes

Hashes for pydiatra-0.12.7.tar.gz
Algorithm Hash digest
SHA256 98defd832ea9d9d794b1c229d9293519d85bf395213bea267bfa4a135f849a7f
MD5 abc8ec8d2b0c7cd05aadca54a5c122eb
BLAKE2b-256 2b95ca1263a17bd883dac0b782de66ba7551814ba35fb46850c94a789599ecb5

See more details on using hashes here.

Supported by

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