mirror of
https://github.com/cisagov/manage.get.gov.git
synced 2025-08-13 13:09:41 +02:00
Linting (but real)
This commit is contained in:
parent
860e445ea8
commit
4054bef461
2 changed files with 6 additions and 8 deletions
|
@ -22,6 +22,10 @@ class Command(BaseCommand):
|
||||||
# and, in all cases, make sure to use a list (not a string) for flags/args
|
# and, in all cases, make sure to use a list (not a string) for flags/args
|
||||||
# as this will quote the output.
|
# as this will quote the output.
|
||||||
linters = {
|
linters = {
|
||||||
|
"mypy": {
|
||||||
|
"purpose": "Type checking",
|
||||||
|
"args": ["mypy", "."],
|
||||||
|
},
|
||||||
"flake8": {
|
"flake8": {
|
||||||
"purpose": "Linting",
|
"purpose": "Linting",
|
||||||
"args": ["flake8", ".", "--count", "--show-source", "--statistics"],
|
"args": ["flake8", ".", "--count", "--show-source", "--statistics"],
|
||||||
|
@ -30,10 +34,6 @@ class Command(BaseCommand):
|
||||||
"purpose": "Formatting",
|
"purpose": "Formatting",
|
||||||
"args": ["black", "--check", "."],
|
"args": ["black", "--check", "."],
|
||||||
},
|
},
|
||||||
"mypy": {
|
|
||||||
"purpose": "Type checking",
|
|
||||||
"args": ["mypy", "."],
|
|
||||||
},
|
|
||||||
"bandit": {
|
"bandit": {
|
||||||
"purpose": "Security scanning",
|
"purpose": "Security scanning",
|
||||||
"args": ["bandit", "-r", "."],
|
"args": ["bandit", "-r", "."],
|
||||||
|
|
|
@ -27,13 +27,11 @@ class DomainHelper:
|
||||||
return bool(cls.DOMAIN_REGEX.match(domain))
|
return bool(cls.DOMAIN_REGEX.match(domain))
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def validate(cls, domain: str | None, blank_ok=False) -> str:
|
def validate(cls, domain: str, blank_ok=False) -> str:
|
||||||
"""Attempt to determine if a domain name could be requested."""
|
"""Attempt to determine if a domain name could be requested."""
|
||||||
|
|
||||||
# Split into pieces for the linter
|
# Split into pieces for the linter
|
||||||
cleaned_domain = cls._validate_domain_string(domain, blank_ok)
|
domain = cls._validate_domain_string(domain, blank_ok)
|
||||||
if cleaned_domain is not None:
|
|
||||||
domain = cleaned_domain
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
if not check_domain_available(domain):
|
if not check_domain_available(domain):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue