Skip to main content
flake8-strict
=============

.. image:: https://travis-ci.org/smarkets/flake8-strict.png?branch=master
:alt: Build status
:target: https://travis-ci.org/smarkets/flake8-strict

Flake8 plugin that checks Python code against a set of opinionated style rules.

Compatible with Python 2.7, 3.3+, PyPy 2.6+ and PyPy 2.4+.

PyPI page: https://pypi.python.org/pypi/flake8_strict

GitHub page: https://github.com/smarkets/flake8-strict

To install using PyPI and pip::

pip install flake8-strict


Error codes
-----------

* ``S100``: First argument on the same line
* ``S101``: Multi-line construct missing trailing comma


Limitations
-----------

* only source code without print statements is supported, this means:

* all valid Python 3 code
* Python 2 code with ``print_function`` enabled

* the existing checks are quite basic, they'll be improved and new
ones will added
* line/column numbers are off currently
* code like this will cause a parsing error (lib2to3.pgen2.parse.ParseError:
bad input)::

some_name(
x for x in range(1),
)

It's ironic but the trailing comma is the issue here, without it parsing
works ok::

some_name(
x for x in range(1)
)

This is a limitation of the underlying parser library and is unlikely to
be fixed in near future. Suggested workaround: wrap the generator in
parentheses, like this::

some_name(
(x for x in range(1)),
)

If the function being called is dict or set the function calls can be
replaced with dict and set comprehensions therefore avoiding the issue
completely.



Versioning and backwards compatibility
--------------------------------------

Below 1.0.0: no guarantees.
Above 1.0.0, given a version number MAJOR.MINOR.PATCH:

* MAJOR is updated when backwards incompatible changes happen
* MINOR is updated when a new, backwards compatible, features are introduced
* PATCH is updated when a backwards compatible bug fixes are applied

Changes
-------

0.2.1
'''''

* Fix blib2to3 import

0.2.0
'''''

* Use custom lib2to3 for better support for Python 3.6+
* Fix trailing comma after *args/**kwargs for Python 3.6+
* Allow usage of Python 3.6 features (e.g f-strings) without crashing

0.1.9
'''''

* Fixed elements inside class definition not being linted correctly (issue #36)

0.1.8
'''''

* Revert previous change (0.1.7) due to a lib2to3 issue.

0.1.7
'''''

* Fixed trailing comma after *args/**kwargs for Python 3.6+ (issue #25)

0.1.6
'''''

* Fixed decorator arguments not being linted.
* Fixed multiline imports not being linted.
* Fixed class definitions not being linted.

0.1.5
'''''

* Fixed UnicodeDecodeError if file contains non-ascii symbols (issue #22)
* Fixed error if newline is omitted from end of file (issue #18)
* Fixed erroneous comma suggested when unpacking function parameter (issue #21)

0.1.4
'''''

* Fixed handling of one-element lists (https://github.com/smarkets/flake8-strict/issues/15)

0.1.3
'''''

* Fixed reading from stdin
* Fixed not being able to run when pycodestyle, not pep8, is installed (pep8
has been renamed to pycodestyle and flake8 2.6.0+ doesn't trigger pep8
installation anymore)
* Added support for set, list and dict literals and comprehensions
* Function calls with single, multi-line arguments are now treated more reasonably

0.1.2
'''''

* Fixed a "ValueError: need more than 2 values to unpack" error (GitHub issue #1).
* Fixed handling argument lists with keyword-only arguments
(compatibility with PEP 3102), this now doesn't raise S101 in this
case as it would be a syntax error.

0.1.1
'''''

* Fixed few ``AttributeError: 'Node' object has no attribute 'lineno'`` errors

0.1.0
'''''

First release


License
-------

Copyright (C) 2015 Smarkets Limited <support@smarkets.com>

This module is released under the MIT License: http://www.opensource.org/licenses/mit-license.php (or see the LICENSE file)


Metadata

Release files for flake8_strict 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for flake8_strict 0.2.1
File Size Uploaded
flake8_strict-0.2.1.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for flake8_strict 0.2.1
File Interpreter ABI Platform
flake8_strict-0.2.1-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 11.9 kB

Release files / flake8_strict-0.2.1.tar.gz

Download URL flake8_strict-0.2.1.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
75d5c11babe3f3b2bc5349e645112571a1d80d6183bda99afe5ffdfc70192d10
BLAKE2b-256 checksum
How to use checksums
cbe7d1e2fd6d3e1991b0ac7cf7db777847a1ed299c45235d19595c275783d38c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / flake8_strict-0.2.1-py2.py3-none-any.whl

Download URL flake8_strict-0.2.1-py2.py3-none-any.whl
Size 5.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
2ef66f75f9215c2084ae7d1b18e158a3c392141a5621ecab28858256ea75d41e
BLAKE2b-256 checksum
How to use checksums
2eb42de7d499d065bd9c37cd730a4c25bc894d9639352c307114531fbadc43e8
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.1 This release

2 release files

0.2.0

2 release files

0.1.9

2 release files

0.1.8

2 release files

0.1.7

2 release files

0.1.6

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page