From 9dbde1bdbaab83c7d3c937ca74e6717db8c92081 Mon Sep 17 00:00:00 2001 From: Tobias Gruetzmacher Date: Sun, 11 Dec 2022 20:15:09 +0100 Subject: [PATCH] Update flake8 & plugins (#251) Additionally, this adds some hackery to let flake8 read its config from pyproject.toml. --- .gitignore | 1 + dosagelib/plugins/comicfury.py | 2 +- dosagelib/plugins/comicskingdom.py | 2 +- dosagelib/plugins/gocomics.py | 2 +- dosagelib/plugins/old.py | 4 ++-- dosagelib/plugins/webtoons.py | 2 +- pyproject.toml | 15 +++++++++++++++ setup.cfg | 15 +++++++++------ tox.ini | 10 ++-------- 9 files changed, 33 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index 9f407d15e..04a4913a6 100644 --- a/.gitignore +++ b/.gitignore @@ -5,6 +5,7 @@ /.coverage /.eggs /.tox +/.venv /Comics /build /dist diff --git a/dosagelib/plugins/comicfury.py b/dosagelib/plugins/comicfury.py index e8dd622e8..7df2a69a6 100644 --- a/dosagelib/plugins/comicfury.py +++ b/dosagelib/plugins/comicfury.py @@ -86,7 +86,7 @@ class ComicFury(ParserScraper): not data.xpath('//div[@id="comicimagewrap"]//img')) @classmethod - def getmodules(cls): # noqa: Allowed to be long + def getmodules(cls): # noqa: CFQ001 return ( # Cannot be found via search?!? cls('BadassologyByMichaelBay', 'strudelology'), diff --git a/dosagelib/plugins/comicskingdom.py b/dosagelib/plugins/comicskingdom.py index f87115a44..48cf54b65 100644 --- a/dosagelib/plugins/comicskingdom.py +++ b/dosagelib/plugins/comicskingdom.py @@ -31,7 +31,7 @@ class ComicsKingdom(ParserScraper): }) @classmethod - def getmodules(cls): # noqa: Allowed to be long + def getmodules(cls): # noqa: CFQ001 return ( # Some comics are not listed on the "all" page (too old?) cls('Retail', 'retail'), diff --git a/dosagelib/plugins/gocomics.py b/dosagelib/plugins/gocomics.py index ae45fe31c..0e76ec548 100644 --- a/dosagelib/plugins/gocomics.py +++ b/dosagelib/plugins/gocomics.py @@ -34,7 +34,7 @@ class GoComics(ParserScraper): return data.xpath('//img[contains(@src, "content-error-missing")]') @classmethod - def getmodules(cls): # noqa: Allowed to be long + def getmodules(cls): # noqa: CFQ001 return ( # old comics removed from the listing cls('HeavenlyNostrils', 'heavenly-nostrils'), diff --git a/dosagelib/plugins/old.py b/dosagelib/plugins/old.py index e6a616522..9f06968c2 100644 --- a/dosagelib/plugins/old.py +++ b/dosagelib/plugins/old.py @@ -28,7 +28,7 @@ class Removed(Scraper): return {'rem-' + self.reason: self.REASONS[self.reason]} @classmethod - def getmodules(cls): # noqa: Allowed to be long + def getmodules(cls): # noqa: CFQ001 return ( # Removed in 2.16 cls('AbleAndBaker'), @@ -1600,7 +1600,7 @@ class Renamed(Scraper): return {'ren-%i' % self.i: self.MSG % self.newname} @classmethod - def getmodules(cls): # noqa: Allowed to be long + def getmodules(cls): return ( # Renamed in 2.16 cls('1997', '1977'), diff --git a/dosagelib/plugins/webtoons.py b/dosagelib/plugins/webtoons.py index dcb0fb1f5..74b1dd8bd 100644 --- a/dosagelib/plugins/webtoons.py +++ b/dosagelib/plugins/webtoons.py @@ -45,7 +45,7 @@ class WebToons(ParserScraper): return "%s-%03d.%s" % (episodeNum, imageNum, imageExt) @classmethod - def getmodules(cls): # noqa: Allowed to be long + def getmodules(cls): # noqa: CFQ001 return ( cls('1000', 'action/one-thousand', 1217), cls('10thDimensionBoys', 'comedy/10th-dimension-boys', 71), diff --git a/pyproject.toml b/pyproject.toml index 94d86dc54..9987e4338 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -3,3 +3,18 @@ requires = ["setuptools>=45", "wheel", "setuptools_scm>=6.2"] build-backend = "setuptools.build_meta" [tool.setuptools_scm] + +[tool.flake8] +max_line_length = 100 +ignore = [ + 'E127', 'E128', # hanging instead of visual indent + 'FI18', 'FI58', # ignore __future__ "annotations" for now + 'W504' # line breaks after binary operator +] +noqa-require-code = true +no-accept-encodings = true +min-version = "3.7" +extend-exclude = [ + '.venv', + 'build', +] diff --git a/setup.cfg b/setup.cfg index d85a78921..7d82af84f 100644 --- a/setup.cfg +++ b/setup.cfg @@ -55,7 +55,12 @@ css = cssselect dev = allure-pytest - flake8<4 + pytest-cov + pytest-xdist + responses + setup-cfg-fmt +lint = + flake8<6 flake8-2020 flake8-breakpoint flake8-bugbear @@ -64,15 +69,13 @@ dev = flake8-comprehensions flake8-eradicate flake8-fixme - flake8-functions==0.0.4 + flake8-functions flake8-future-import flake8-logging-format + flake8-noqa + Flake8-pyproject flake8-pytest flake8-pytest-style - pytest-cov - pytest-xdist - responses - setup-cfg-fmt [bdist_wheel] universal = 1 diff --git a/tox.ini b/tox.ini index a314ddcd3..4e6acd7af 100644 --- a/tox.ini +++ b/tox.ini @@ -31,14 +31,8 @@ extras = commands = - {envbindir}/flake8 --format=pylint \ --tee --output-file={toxworkdir}/flake8.log - -[flake8] -# we aim for 79, but this suppresses warnings for now... -max-line-length = 100 -ignore = E127,E128,E241,FI12,FI14,FI15,FI18,FI50,FI51,FI53,FI54,FI55,FI58,W504 -require-code = True -no-accept-encodings = True -min-version = 3.7 +extras = + lint # Duplicated for CodeClimate... [pep8]