Skip to content

Commit

Permalink
Move flake8 configuration to its own file and activate some plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
Sylvain Thénault committed Dec 3, 2020
1 parent 20a70f4 commit 557180f
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 12 deletions.
28 changes: 28 additions & 0 deletions .flake8
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[flake8]
#format = pylint
ignore =
A003, # attribute overriding builtin name
B006, # [bugbear] Do not use mutable data structures for argument defaults (I choose by myself)
E123, # closing bracket does not match indentation of opening bracket's line (disagree with emacs python mode)
E126, # continuation line over-indented for hanging indent line (disagree with emacs python mode)
E226, # missing whitespace around arithmetic operator (disagree when in parameter)
P101, # [string-format] format string does contain unindexed parameters (don't care of py2.6)
P103, # [string-format] other string does contain unindexed parameters
P102, # [string-format] docstring does contain unindexed parameters
W503, # Line break occurred before a binary operator (to keep operators aligned)

max-line-length = 80
exclude = doc/*,.tox/*,.eggs,test/data
#import-order-style = google
#application-import-names=lowatt_core
rst-roles =
class,
envvar,
func,
meth,
ref,
rst-directives =
autoattribute,
autoclass,
autofunction,
automethod,
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include .flake8
include requirements.txt
include pytest.ini
include tox.ini
Expand Down
8 changes: 4 additions & 4 deletions pdfss.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ def default_group_line(linfo, latest_linfo):
diff = abs(latest_linfo.font_size - linfo.font_size)
if ((linfo.font_name.endswith('-bold')
and not latest_linfo.font_name.endswith('-bold'))
or
or # noqa
(latest_linfo.font_name.endswith('-bold')
and not linfo.font_name.endswith('-bold'))):
allowed_y_diff = diff * 1.5
Expand Down Expand Up @@ -311,15 +311,15 @@ def default_iter_text(ltobj, skip_classes=None):
yield ltobj

else:
assert False, ltobj
raise RuntimeError("Unexpected object", ltobj)


def relayout(
ltobj, skip_classes=DEFAULT_SKIP_CLASSES, skip_text=None,
iter_text=default_iter_text,
ltchar_filter=None,
merge_text=default_text_merger(),
group_line=default_line_grouper(),
merge_text=default_text_merger(), # noqa
group_line=default_line_grouper(), # noqa
):
"""Return a list of :class:LinesGroup for given PDFMiner `ltobj` instance.
Expand Down
20 changes: 12 additions & 8 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,20 @@ commands =
{envpython} -m unittest discover -s test -c {posargs}

[testenv:flake8]
skip_install = true
deps =
flake8
changedir={toxinidir}
flake8-blind-except
flake8-bugbear
flake8-builtins
flake8-commas
flake8-comprehensions
flake8-debugger
flake8-logging-format
flake8-rst-docstrings
flake8-pep3101
#flake8-print
flake8-string-format
skip_install = true
commands = flake8

[testenv:check-manifest]
Expand All @@ -29,9 +39,3 @@ deps =
check-manifest
commands =
{envpython} -m check_manifest {toxinidir}

[flake8]
#format = pylint
#ignore = W503
max-line-length = 80
exclude = doc/*,.tox/*,test/data/*

0 comments on commit 557180f

Please sign in to comment.