Skip to content

Commit

Permalink
Add a config file for test_codestyle.py (#594)
Browse files Browse the repository at this point in the history
pycodestyle supports reading config options from a file.
This change adds such a file and modifies test_codestyle.py
to reference it.

Removes ignoring of E402 (module level import not at top of file)
because we don't violate it now.

Sets the line length to 99, but continues to ignore E501 (line
too long) because we have a lot of those.
  • Loading branch information
jamessynge authored and wtgee committed Sep 15, 2018
1 parent f8a9b5b commit 3358d3f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
16 changes: 16 additions & 0 deletions .pycodestyle.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
[pycodestyle]
; Pycodestyle config options are:
; exclude, filename, select, ignore, max-line-length, max-doc-length,
; hang-closing, count, format, quiet, show-pep8, show-source,
; statistics, verbose

; Style violations to ignore.
;
; E501: line too long (82 > 79 characters)
;
; For the full list, see:
; https://pycodestyle.readthedocs.io/en/latest/intro.html#error-codes

ignore = E501

max-line-length = 99
5 changes: 4 additions & 1 deletion pocs/tests/test_codestyle.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import pycodestyle
import pytest

Expand All @@ -9,7 +11,8 @@ def dirs_to_check(request):

def test_conformance(dirs_to_check):
"""Test that we conform to PEP-8."""
style = pycodestyle.StyleGuide(quiet=False, ignore=['E501', 'E402'])
config_file = os.path.join(os.environ['POCS'], '.pycodestyle.cfg')
style = pycodestyle.StyleGuide(quiet=False, config_file=config_file)

print(dirs_to_check)
style.input_dir(dirs_to_check)
Expand Down

0 comments on commit 3358d3f

Please sign in to comment.