diff options
author | Jon Dufresne <jon.dufresne@gmail.com> | 2020-04-16 15:04:22 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-16 15:04:22 -0700 |
commit | 05548a373f780c512bc7f7a12a18173d19437b12 (patch) | |
tree | 18706364ea48098db554f975ca1af3302afd97e2 | |
parent | ae173f0f5126dcd8db9f43d6fdb37439873e9233 (diff) | |
download | redis-py-05548a373f780c512bc7f7a12a18173d19437b12.tar.gz |
Switch to flake8 for static code analysis (#1328)
flake8 catches a wider net of mistakes than pycodestyle and is more
commonly used by the larger community. For example, it catches unused
imports, a few of which existed. These have since been removed.
Two "noqa" comments were added. One ignores the _compat.py file as it
has a large amount of Python version specific code. The second is in
utils.py which intentionally does not use an import.
-rw-r--r-- | .travis.yml | 4 | ||||
-rw-r--r-- | benchmarks/command_packer_benchmark.py | 1 | ||||
-rw-r--r-- | redis/_compat.py | 1 | ||||
-rwxr-xr-x | redis/client.py | 1 | ||||
-rwxr-xr-x | redis/connection.py | 1 | ||||
-rw-r--r-- | redis/utils.py | 2 | ||||
-rw-r--r-- | setup.cfg | 3 | ||||
-rw-r--r-- | tox.ini | 8 |
8 files changed, 9 insertions, 12 deletions
diff --git a/.travis.yml b/.travis.yml index 702082e..d530e4a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,7 +2,7 @@ language: python cache: pip matrix: include: - - env: TOXENV=pycodestyle + - env: TOXENV=flake8 - python: 2.7 env: TOXENV=py27-plain - python: 2.7 @@ -39,4 +39,4 @@ install: script: - tox after_success: - - "if [[ $TOXENV != 'pycodestyle' ]]; then codecov; fi" + - "if [[ $TOXENV != 'flake8' ]]; then codecov; fi" diff --git a/benchmarks/command_packer_benchmark.py b/benchmarks/command_packer_benchmark.py index dae6fa4..1216df6 100644 --- a/benchmarks/command_packer_benchmark.py +++ b/benchmarks/command_packer_benchmark.py @@ -1,5 +1,4 @@ import socket -import sys from redis.connection import (Connection, SYM_STAR, SYM_DOLLAR, SYM_EMPTY, SYM_CRLF) from redis._compat import imap diff --git a/redis/_compat.py b/redis/_compat.py index 146e37d..a0036de 100644 --- a/redis/_compat.py +++ b/redis/_compat.py @@ -1,4 +1,5 @@ """Internal module for Python 2 backwards compatibility.""" +# flake8: noqa import errno import socket import sys diff --git a/redis/client.py b/redis/client.py index 7454321..cc77515 100755 --- a/redis/client.py +++ b/redis/client.py @@ -1,7 +1,6 @@ from __future__ import unicode_literals from itertools import chain import datetime -import sys import warnings import time import threading diff --git a/redis/connection.py b/redis/connection.py index a13bcd3..99c5f23 100755 --- a/redis/connection.py +++ b/redis/connection.py @@ -6,7 +6,6 @@ import errno import io import os import socket -import sys import threading import warnings diff --git a/redis/utils.py b/redis/utils.py index 0b0067e..6ef6fd4 100644 --- a/redis/utils.py +++ b/redis/utils.py @@ -2,7 +2,7 @@ from contextlib import contextmanager try: - import hiredis + import hiredis # noqa HIREDIS_AVAILABLE = True except ImportError: HIREDIS_AVAILABLE = False @@ -35,8 +35,7 @@ python_requires = >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.* [options.extras_require] hiredis = hiredis>=0.1.3 -[pycodestyle] -show-source = 1 +[flake8] exclude = .venv,.tox,dist,docs,build,*.egg,redis_install [bdist_wheel] @@ -1,6 +1,6 @@ [tox] minversion = 2.4 -envlist = {py27,py35,py36,py37,py38,py,py3}-{plain,hiredis}, pycodestyle +envlist = {py27,py35,py36,py37,py38,py,py3}-{plain,hiredis}, flake8 [testenv] deps = @@ -11,9 +11,9 @@ extras = hiredis: hiredis commands = {envpython} -b -m coverage run -m pytest -W always {posargs} -[testenv:pycodestyle] +[testenv:flake8] basepython = python3.6 -deps = pycodestyle -commands = pycodestyle +deps = flake8 +commands = flake8 skipsdist = true skip_install = true |