From c2b30f17ebac1493460e7db091a75e2bed03db71 Mon Sep 17 00:00:00 2001 From: Julian Rother <julian@cccv.de> Date: Fri, 20 Oct 2023 00:50:08 +0200 Subject: [PATCH] Update pylint to v2.16.2 for python3.11 compatibility --- .gitlab-ci.yml | 2 +- .pylintrc | 13 ++++--------- uffd/models/session.py | 3 +-- uffd/password_hash.py | 2 +- uffd/remailer.py | 2 -- uffd/views/api.py | 2 +- uffd/views/service.py | 2 +- 7 files changed, 9 insertions(+), 17 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 352623f8..d70dc575 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -5,7 +5,7 @@ variables: GIT_SUBMODULE_STRATEGY: normal APT_API_URL: https://packages.cccv.de APT_REPO: uffd - PYLINT_PIN: pylint~=2.10.0 + PYLINT_PIN: pylint~=2.16.2 before_script: - python3 -V diff --git a/.pylintrc b/.pylintrc index f3f57828..90cd22f4 100644 --- a/.pylintrc +++ b/.pylintrc @@ -68,6 +68,8 @@ disable=missing-module-docstring, too-many-ancestors, duplicate-code, redefined-builtin, + superfluous-parens, + consider-using-f-string, # Temporary # Enable the message, report, category or checker with the given id(s). You can # either give multiple identifier separated by comma (,) or put this option @@ -386,13 +388,6 @@ max-line-length=160 # Maximum number of lines in a module. max-module-lines=1000 -# List of optional constructs for which whitespace checking is disabled. `dict- -# separator` is used to allow tabulation in dicts, etc.: {1 : 1,\n222: 2}. -# `trailing-comma` allows a space between comma and closing bracket: (a, ). -# `empty-line` allows space-only lines. -no-space-check=trailing-comma, - dict-separator - # Allow the body of a class to be on the same line as the declaration if body # contains single statement. single-line-class-stmt=no @@ -513,5 +508,5 @@ min-public-methods=2 # Exceptions that will emit a warning when being caught. Defaults to # "BaseException, Exception". -overgeneral-exceptions=BaseException, - Exception +overgeneral-exceptions=builtin.BaseException, + builtin.Exception diff --git a/uffd/models/session.py b/uffd/models/session.py index 19fa3ad8..a594e231 100644 --- a/uffd/models/session.py +++ b/uffd/models/session.py @@ -70,8 +70,7 @@ class DeviceLoginInitiation(db.Model): existing and possibly attacker-controlled code). An initiation code is securly bound to the session that it was created - with by storing both id and secret in the encrypted and authenticated - session cookie.''' + with by storing both id and secret in the authenticated session cookie.''' __tablename__ = 'device_login_initiation' id = Column(Integer(), primary_key=True, autoincrement=True) diff --git a/uffd/password_hash.py b/uffd/password_hash.py index bd941ea1..78d0da47 100644 --- a/uffd/password_hash.py +++ b/uffd/password_hash.py @@ -206,7 +206,7 @@ class InvalidPasswordHash: def __init__(self, value=None): self.value = value - # pylint: disable=no-self-use,unused-argument + # pylint: disable=unused-argument def verify(self, password): return False diff --git a/uffd/remailer.py b/uffd/remailer.py index f3ffd079..14c42f0a 100644 --- a/uffd/remailer.py +++ b/uffd/remailer.py @@ -14,8 +14,6 @@ class Remailer: Version 2 of the remailer address format is tolerant to case conversions at the cost of being slightly longer.''' - # pylint: disable=no-self-use - @property def configured(self): return bool(current_app.config['REMAILER_DOMAIN']) diff --git a/uffd/views/api.py b/uffd/views/api.py index d0be61d4..815a4d4f 100644 --- a/uffd/views/api.py +++ b/uffd/views/api.py @@ -180,7 +180,7 @@ def prometheus_metrics(): from prometheus_client import PLATFORM_COLLECTOR, generate_latest, CONTENT_TYPE_LATEST #pylint: disable=import-outside-toplevel class UffdCollector(): - def collect(self): #pylint: disable=no-self-use + def collect(self): try: uffd_version = str(pkg_resources.get_distribution('uffd').version) except pkg_resources.DistributionNotFound: diff --git a/uffd/views/service.py b/uffd/views/service.py index 374180ca..f08217a3 100644 --- a/uffd/views/service.py +++ b/uffd/views/service.py @@ -28,7 +28,7 @@ def overview_login_maybe_required(func): return decorator def overview_navbar_visible(): - return get_services(request.user) != [] or admin_acl() + return get_services(request.user) or admin_acl() @bp.route('/services/') @register_navbar(lazy_gettext('Services'), icon='sitemap', blueprint=bp, visible=overview_navbar_visible) -- GitLab