diff --git a/tildes/prospector.yaml b/tildes/prospector.yaml index d1d7bed..de62846 100644 --- a/tildes/prospector.yaml +++ b/tildes/prospector.yaml @@ -1,4 +1,5 @@ -strictness: none +strictness: none # prevents using Prospector's default strictness profiles + doc-warnings: true max-line-length: 88 @@ -28,7 +29,7 @@ pylint: - 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 + - logging-format-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 diff --git a/tildes/requirements-dev.txt b/tildes/requirements-dev.txt index 4033544..321d315 100644 --- a/tildes/requirements-dev.txt +++ b/tildes/requirements-dev.txt @@ -3,7 +3,7 @@ alembic==1.3.2 amqpy==0.13.1 appdirs==1.4.3 # via black argon2-cffi==19.2.0 -astroid==2.2.5 # via prospector, pylint, pylint-celery, pylint-flask, requirements-detector +astroid==2.3.3 # via prospector, pylint, pylint-celery, pylint-flask, requirements-detector attrs==19.3.0 # via black, pytest backcall==0.1.0 # via ipython beautifulsoup4==4.8.1 @@ -49,7 +49,7 @@ plaster==1.0 # via plaster-pastedeploy, pyramid pluggy==0.13.1 # via pytest prometheus-client==0.7.1 prompt-toolkit==3.0.2 # via ipython -prospector==1.1.7 +prospector==1.2.0 psycopg2==2.8.4 ptyprocess==0.6.0 # via pexpect publicsuffix2==2.20160818 @@ -57,14 +57,14 @@ py==1.8.0 # via pytest pycodestyle==2.4.0 # via prospector pycparser==2.19 # via cffi pydocstyle==5.0.1 # via prospector -pyflakes==1.6.0 # via prospector +pyflakes==2.1.1 # via prospector pygit2==1.0.0 pygments==2.5.2 pylint-celery==0.3 # via prospector -pylint-django==2.0.10 # via prospector +pylint-django==2.0.12 # via prospector pylint-flask==0.6 # via prospector pylint-plugin-utils==0.6 # via prospector, pylint-celery, pylint-django, pylint-flask -pylint==2.3.1 # via prospector, pylint-celery, pylint-django, pylint-flask, pylint-plugin-utils +pylint==2.4.4 # via prospector, pylint-celery, pylint-django, pylint-flask, pylint-plugin-utils pyotp==2.3.0 pyparsing==2.4.5 # via packaging pyramid-debugtoolbar==4.5.1 diff --git a/tildes/scripts/backup_database.py b/tildes/scripts/backup_database.py index 81cde64..318ca0d 100644 --- a/tildes/scripts/backup_database.py +++ b/tildes/scripts/backup_database.py @@ -36,11 +36,14 @@ def create_encrypted_backup(gpg_recipient: str) -> str: # dump the database to a file with open(f"{filename}.sql", "w") as dump_file: subprocess.run( - ["pg_dump", "-U", "tildes", "tildes"], stdout=dump_file, text=True + ["pg_dump", "-U", "tildes", "tildes"], + stdout=dump_file, + text=True, + check=True, ) # gzip the dump file (replaces it) - subprocess.run(["gzip", "-9", f"{filename}.sql"]) + subprocess.run(["gzip", "-9", f"{filename}.sql"], check=True) # encrypt the compressed dump file using gpg subprocess.run( @@ -52,7 +55,8 @@ def create_encrypted_backup(gpg_recipient: str) -> str: "--recipient", gpg_recipient, f"{filename}.sql.gz", - ] + ], + check=True, ) # delete the unencrypted dump file @@ -65,7 +69,7 @@ def upload_new_backup(host: str, gpg_recipient: str) -> None: """Create a new (encrypted) backup and then upload it to the FTP.""" new_filename = create_encrypted_backup(gpg_recipient) - subprocess.run(["lftp", "-e", f"put {new_filename}; bye", host]) + subprocess.run(["lftp", "-e", f"put {new_filename}; bye", host], check=True) logging.info(f"Successfully uploaded {new_filename} to FTP.") diff --git a/tildes/scripts/breached_passwords.py b/tildes/scripts/breached_passwords.py index 64eab8a..7b5d301 100644 --- a/tildes/scripts/breached_passwords.py +++ b/tildes/scripts/breached_passwords.py @@ -128,7 +128,7 @@ def addhashes(filename: str) -> None: # call wc to count the number of lines in the file for the progress bar click.echo("Determining hash count...") - result = subprocess.run(["wc", "-l", filename], stdout=subprocess.PIPE) + result = subprocess.run(["wc", "-l", filename], stdout=subprocess.PIPE, check=True) line_count = int(result.stdout.split(b" ")[0]) progress_bar: Any = click.progressbar(length=line_count) diff --git a/tildes/tildes/lib/html.py b/tildes/tildes/lib/html.py index 49920c4..8067ee7 100644 --- a/tildes/tildes/lib/html.py +++ b/tildes/tildes/lib/html.py @@ -16,7 +16,7 @@ def add_anchors_to_headings(html: str) -> str: for heading in headings: # generate an anchor from the string contents of the heading - anchor = convert_to_url_slug("".join([string for string in heading.strings])) + anchor = convert_to_url_slug("".join(heading.strings)) # create a link to that anchor, and put the heading's contents inside it link = soup.new_tag("a", href=f"#{anchor}") diff --git a/tildes/tildes/lib/string.py b/tildes/tildes/lib/string.py index e2586fa..f3105a7 100644 --- a/tildes/tildes/lib/string.py +++ b/tildes/tildes/lib/string.py @@ -243,7 +243,7 @@ def extract_text_from_html(html: str, skip_tags: Optional[List[str]] = None) -> html_tree = HTMLParser(namespaceHTMLElements=False).parseFragment(html) # extract the text from all of the HTML elements - extracted_text = "".join([text for text in extract_text(html_tree, skip_tags)]) + extracted_text = "".join(extract_text(html_tree, skip_tags)) # sanitize unicode, remove leading/trailing whitespace, etc. return simplify_string(extracted_text) diff --git a/tildes/tildes/models/comment/comment.py b/tildes/tildes/models/comment/comment.py index e7a86f9..e9df523 100644 --- a/tildes/tildes/models/comment/comment.py +++ b/tildes/tildes/models/comment/comment.py @@ -106,7 +106,7 @@ class Comment(DatabaseModel): Index("ix_comments_search_tsv_gin", "search_tsv", postgresql_using="gin"), ) - @hybrid_property + @hybrid_property # pylint: disable=used-before-assignment def markdown(self) -> str: """Return the comment's markdown.""" return self._markdown diff --git a/tildes/tildes/models/topic/topic.py b/tildes/tildes/models/topic/topic.py index bfe92cb..ecb2f1f 100644 --- a/tildes/tildes/models/topic/topic.py +++ b/tildes/tildes/models/topic/topic.py @@ -144,7 +144,7 @@ class Topic(DatabaseModel): Index("ix_topics_search_tsv_gin", "search_tsv", postgresql_using="gin"), ) - @hybrid_property + @hybrid_property # pylint: disable=used-before-assignment def markdown(self) -> Optional[str]: """Return the topic's markdown.""" if not self.is_text_type: