Skip to content

Commit

Permalink
Poetry (#37)
Browse files Browse the repository at this point in the history
* poetry

* travis

* travis2

* update python versions of test

* update requirements

* rerun lock
  • Loading branch information
JBKahn committed Oct 12, 2019
1 parent d35957c commit d00109a
Show file tree
Hide file tree
Showing 9 changed files with 584 additions and 206 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
*.egg-info
*.pyc
dist
.mypy_cache
18 changes: 6 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,18 @@
language: python
python:
- "2.7"
- "3.4"
- "3.5"
- "3.6"
- "3.7"

env:
matrix:
- FLAKE8_VERSION=""
- FLAKE8_VERSION="1.5"
- FLAKE8_VERSION="2.1"
- FLAKE8_VERSION="3.2.1"

matrix:
exclude:
- python: "3.5"
env: FLAKE8_VERSION="1.5"

install:
- pip install pycodestyle
- if [[ -n "$FLAKE8_VERSION" ]]; then pip install flake8=="$FLAKE8_VERSION"; fi
- python setup.py install
script: "pytest"
- pip install poetry
- poetry install
- if [[ -n "$FLAKE8_VERSION" ]]; then poetry run pip install flake8=="$FLAKE8_VERSION"; fi
script:
- poetry run pytest
69 changes: 27 additions & 42 deletions README.rst → README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,93 +26,78 @@ available in ``flake8``::

Error codes
-----------
+------------+-------------------------------------+
| Error code | Description |
+============+=====================================+
| T001 | print found |
+------------+-------------------------------------+
| T002 | Python 2.x reserved word print used |
+------------+-------------------------------------+
| T003 | pprint found |
+------------+-------------------------------------+
| T004 | pprint declared |
+------------+-------------------------------------+

| Error Code | Description |
| ----------- | ------------------------------------ |
| T001 | print found |
| T002 | Python 2.x reserved word print used |
| T003 | pprint found |
| T004 | pprint declared |


Changes
-------

3.1.1 - 2019-03-12
``````````````````
##### 3.1.1 - 2019-03-12

* Fix reading from stdin when it is closed.
* Fix reading from stdin when it is closed (requires flake8 > 2.1).
* Add error codes to ReadMe.
* Swapped to poetry from setup.py
* Ran black on the repository

3.1.0 - 2018-02-11
``````````````````
##### 3.1.0 - 2018-02-11
* Add a framework classifier for use in pypi.org
* Fix entry_point in setup.py leaving it off by default again.

3.0.1 - 2017-11-06
``````````````````
##### 3.0.1 - 2017-11-06
* Fix conflict in setup.py leaving it off by default again.
* Fix bug in name code.

3.0.0 - 2017-11-05
``````````````````
##### 3.0.0 - 2017-11-05
* Remove some of the python 2/3 message differentiation.
* Use an AST rather than a logical line checker with a regex.
* pprint support.
* Loss of multiline noqa support, until there is a way to use both the AST and have flake8 provide the noqa lines.


2.0.2 - 2016-02-29
``````````````````
##### 2.0.2 - 2016-02-29
* Fix ReadMe for pipy
* Refactor, DRY it up.
* Update python 2 vs python 3 print statement styles.

2.0.1 - 2015-11-21
``````````````````
##### 2.0.1 - 2015-11-21
* Add back the decorator to fix the `flake8 --version` call.

2.0 - 2015-11-10
````````````````
##### 2.0 - 2015-11-10
* Support noqa at end of multiline print statement
* Performance improvements
* Removed PrintStatementChecker class and other functions
* Added T101 for 'Python 2.x reserved word print used.'
* Added testing for Python 3.3 and 3.5, and different flake8 versions

1.6.1 - 2015-05-22
``````````````````
##### 1.6.1 - 2015-05-22
* Fix bug introduced in 1.6.

1.6 - 2015-05-18
````````````````
##### 1.6 - 2015-05-18
* Added proper support for python3 and testing for python 2.6, 2.7 and 3.4

1.5 - 2014-11-04
````````````````
##### 1.5 - 2014-11-04
* Added python2.6 support. Thanks @zoidbergwill

1.4 - 2014-10-06
````````````````
##### 1.4 - 2014-10-06
* Apped noqa support

1.3 - 2014-09-27
````````````````
##### 1.3 - 2014-09-27
* Dropped noqa support
* Support for multiline comments and less false positives

1.2 - 2014-06-30
````````````````
##### 1.2 - 2014-06-30
* Does not catch the word print in single line strings
* Does not catch inline comments with print in it
* Added tests

1.1 - 2014-06-30
````````````````
##### 1.1 - 2014-06-30
* First release

1.0 - 2014-06-30
````````````````
##### 1.0 - 2014-06-30
* Whoops
17 changes: 6 additions & 11 deletions flake8_print.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,21 +8,15 @@
except ImportError:
from flake8 import utils as stdin_utils

__version__ = '3.1.1'
__version__ = "3.1.1"

PRINT_FUNCTION_NAME = "print"
PPRINT_FUNCTION_NAME = "pprint"
PRINT_FUNCTION_NAMES = [PRINT_FUNCTION_NAME, PPRINT_FUNCTION_NAME]

VIOLATIONS = {
'found': {
'print': 'T001 print found.',
'pprint': 'T003 pprint found.',
},
'declared': {
'print': 'T002 Python 2.x reserved word print used.',
'pprint': 'T004 pprint declared',
},
"found": {"print": "T001 print found.", "pprint": "T003 pprint found."},
"declared": {"print": "T002 Python 2.x reserved word print used.", "pprint": "T004 pprint declared"},
}


Expand All @@ -39,7 +33,8 @@ def visit_Print(self, node):
def visit_Call(self, node):
is_print_function = getattr(node.func, "id", None) in PRINT_FUNCTION_NAMES
is_print_function_attribute = (
getattr(getattr(node.func, "value", None), "id", None) in PRINT_FUNCTION_NAMES and getattr(node.func, "attr", None) in PRINT_FUNCTION_NAMES
getattr(getattr(node.func, "value", None), "id", None) in PRINT_FUNCTION_NAMES
and getattr(node.func, "attr", None) in PRINT_FUNCTION_NAMES
)
if is_print_function:
self.prints_used[(node.lineno, node.col_offset)] = VIOLATIONS["found"][node.func.id]
Expand Down Expand Up @@ -72,7 +67,7 @@ def visit_Name(self, node):

class PrintChecker(object):
options = None
name = 'flake8-print'
name = "flake8-print"
version = __version__

def __init__(self, tree, filename):
Expand Down

0 comments on commit d00109a

Please sign in to comment.