Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
kazet committed Dec 26, 2023
1 parent 7dc4df9 commit 195beed
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
3 changes: 3 additions & 0 deletions .mypy.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ ignore_missing_imports = True
[mypy-dkim.*]
ignore_missing_imports = True

[mypy-sphinx_rtd_theme.*]
ignore_missing_imports = True

[mypy-jinja2_simple_tags.*]
ignore_missing_imports = True

Expand Down
22 changes: 12 additions & 10 deletions common/config.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from typing import Annotated, Any, List, get_type_hints

from common.language import Language

import decouple

from common.language import Language

DEFAULTS = {}


Expand All @@ -20,12 +20,12 @@ class Data:
"The URL used to connect to the database (as documented on "
"https://docs.sqlalchemy.org/en/20/core/engines.html#database-urls). The CERT PL "
"production instance uses PostgreSQL - this is the database the system has been most "
"thoroughly tested on."
"thoroughly tested on.",
] = get_config("DB_URL", default=None)
REDIS_MESSAGE_DATA_EXPIRY_SECONDS: Annotated[
int,
"The data in Redis expires in order to make sure Redis never takes too much "
"memory - the full scan logs are stored in a Postgres database."
"memory - the full scan logs are stored in a Postgres database.",
] = get_config("REDIS_MESSAGE_DATA_EXPIRY_SECONDS", cast=int, default=10 * 24 * 60 * 60)
REDIS_URL: Annotated[
str,
Expand All @@ -40,33 +40,35 @@ class Network:
List[str],
"A comma-separated list of nameservers that will be used to resolve domains. If you want "
"to provide custom ones, remember to modify the ones used by Docker. At CERT PL we use a "
"separate `docker-compose.yml` file with additional configuration specific to our instance."
"separate `docker-compose.yml` file with additional configuration specific to our instance.",
] = get_config("NAMESERVERS", default="8.8.8.8", cast=decouple.Csv(str))
SSL_PRIVATE_KEY_PATH: Annotated[
str,
"SSL private key path. Remember:\n"
" 1. to mount it into your Docker container,\n"
" 2. to restart the containers if a new one is generated,\n"
" 2. that autogenerated certificate files may be symbolic links - the destination directory must also be mounted."
" 2. that autogenerated certificate files may be symbolic links - the destination directory must also be mounted.",
] = decouple.config("SSL_PRIVATE_KEY_PATH", default=None)
SSL_CERTIFICATE_PATH: Annotated[str, "SSL certificate path."] = decouple.config("SSL_PRIVATE_KEY_PATH", default=None)
SSL_CERTIFICATE_PATH: Annotated[str, "SSL certificate path."] = decouple.config(
"SSL_PRIVATE_KEY_PATH", default=None
)

class UI:
LANGUAGE: Annotated[
str,
"The language the site will use (in the form of language_COUNTRY, e.g. en_US). "
f"Supported options are: {', '.join(sorted(language.value for language in Language))}."
f"Supported options are: {', '.join(sorted(language.value for language in Language))}.",
] = get_config("LANGUAGE", default="en_US")
OLD_CHECK_RESULTS_AGE_MINUTES: Annotated[
int,
"If the user is viewing old check results, they will see a message that the check result "
"may not describe the current configuration. This is the threshold (in minutes) how old "
"the check results need to be for that message to be displayed."
"the check results need to be for that message to be displayed.",
] = get_config("OLD_CHECK_RESULTS_AGE_MINUTES", default=60, cast=int)
SITE_CONTACT_EMAIL: Annotated[
str,
"The contact e-mail that will be displayed in the UI (currently in the message that "
"describes what to do if e-mails to the system aren't received)."
"describes what to do if e-mails to the system aren't received).",
] = get_config("SITE_CONTACT_EMAIL", default=None)

@staticmethod
Expand Down
3 changes: 2 additions & 1 deletion docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import datetime
import os
import sys
from typing import List

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
Expand Down Expand Up @@ -69,7 +70,7 @@
# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []
html_static_path: List[str] = []


html_css_files = [
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[flake8]
# whitespace before :, too long line, line break before binary operator
ignore = E203,E501,W503
exclude = .venv.translations
exclude = .venv.translations,docs/venv

0 comments on commit 195beed

Please sign in to comment.