From 6a7b42dd87f56c21e829cc51b87a009a847ec07d Mon Sep 17 00:00:00 2001 From: Deimos Date: Wed, 18 Sep 2019 18:36:07 -0600 Subject: [PATCH] Un-pin prospector version The issues that were causing prospector to break have been fixed, so this is safe to un-pin now. Required a few config changes and code updates to fix some new errors that came with the updated versions. --- tildes/prospector.yaml | 3 +++ tildes/requirements-to-freeze.txt | 2 +- tildes/requirements.txt | 10 +++++----- tildes/tildes/lib/database.py | 3 +-- tildes/tildes/lib/message.py | 1 + tildes/tildes/views/login.py | 8 ++++---- 6 files changed, 15 insertions(+), 12 deletions(-) diff --git a/tildes/prospector.yaml b/tildes/prospector.yaml index 8ad5493..ec5c884 100644 --- a/tildes/prospector.yaml +++ b/tildes/prospector.yaml @@ -9,6 +9,7 @@ pep8: disable: # "multiple statements on one line" - type declarations seem to trigger sometimes - E704 + - E203 # whitespace around colons in slices pep257: disable: @@ -26,9 +27,11 @@ pylint: disable: - bad-continuation # let Black handle line-wrapping - comparison-with-callable # seems to have a lot of false positives + - cyclic-import # not sure what's triggering this, doesn't seem to work correctly - logging-fstring-interpolation # rather use f-strings than worry about this - no-else-return # elif after return - could refactor to enable this check - no-self-use # schemas do this a lot, would be nice to only disable for schemas - too-few-public-methods # plenty of classes that don't need multiple methods - too-many-instance-attributes # models have many instance attributes - ungrouped-imports # let isort handle this + - unnecessary-pass # I prefer using pass, even when it's not technically necessary diff --git a/tildes/requirements-to-freeze.txt b/tildes/requirements-to-freeze.txt index e0682bb..2d56bd2 100644 --- a/tildes/requirements-to-freeze.txt +++ b/tildes/requirements-to-freeze.txt @@ -15,7 +15,7 @@ mypy mypy-extensions Pillow prometheus-client -prospector==1.1.6.2 +prospector psycopg2 publicsuffix2==2.20160818 pygit2 diff --git a/tildes/requirements.txt b/tildes/requirements.txt index 3651ad6..780f123 100644 --- a/tildes/requirements.txt +++ b/tildes/requirements.txt @@ -3,7 +3,7 @@ alembic==1.1.0 amqpy==0.13.1 appdirs==1.4.3 argon2-cffi==19.1.0 -astroid==2.0.4 +astroid==2.2.5 atomicwrites==1.3.0 attrs==19.1.0 backcall==0.1.0 @@ -48,7 +48,7 @@ plaster-pastedeploy==0.7 pluggy==0.13.0 prometheus-client==0.7.1 prompt-toolkit==2.0.9 -prospector==1.1.6.2 +prospector==1.1.7 psycopg2==2.8.3 ptyprocess==0.6.0 publicsuffix2==2.20160818 @@ -59,10 +59,10 @@ pydocstyle==4.0.1 pyflakes==1.6.0 pygit2==0.28.2 Pygments==2.4.2 -pylint==2.1.1 +pylint==2.3.1 pylint-celery==0.3 -pylint-django==2.0.2 -pylint-flask==0.5 +pylint-django==2.0.10 +pylint-flask==0.6 pylint-plugin-utils==0.5 pyotp==2.3.0 pyparsing==2.4.2 diff --git a/tildes/tildes/lib/database.py b/tildes/tildes/lib/database.py index 6379641..4f4937d 100644 --- a/tildes/tildes/lib/database.py +++ b/tildes/tildes/lib/database.py @@ -124,8 +124,7 @@ class ArrayOfLtree(ARRAY): # pylint: disable=too-many-ancestors return process - # pylint: disable=invalid-name,too-many-ancestors - class comparator_factory(ARRAY.comparator_factory): + class comparator_factory(ARRAY.comparator_factory): # noqa """Add custom comparison functions. The ancestor_of, descendant_of, and lquery functions are supported by LtreeType, diff --git a/tildes/tildes/lib/message.py b/tildes/tildes/lib/message.py index d11c52f..b563d6d 100644 --- a/tildes/tildes/lib/message.py +++ b/tildes/tildes/lib/message.py @@ -2,6 +2,7 @@ # SPDX-License-Identifier: AGPL-3.0-or-later """Functions/constants related to messages.""" +# flake8: noqa WELCOME_MESSAGE_SUBJECT = "Welcome to the Tildes alpha" diff --git a/tildes/tildes/views/login.py b/tildes/tildes/views/login.py index d198a46..94df5fe 100644 --- a/tildes/tildes/views/login.py +++ b/tildes/tildes/views/login.py @@ -126,12 +126,12 @@ def post_login_two_factor(request: Request, code: str, from_url: str) -> NoRetur .one_or_none() ) - if user.is_correct_two_factor_code(code): - del request.session["two_factor_username"] - raise finish_login(request, user, from_url) - else: + if not user.is_correct_two_factor_code(code): raise HTTPUnauthorized(body="Invalid code, please try again.") + del request.session["two_factor_username"] + raise finish_login(request, user, from_url) + @view_config(route_name="logout", request_method="POST") def post_logout(request: Request) -> HTTPFound: