diff --git a/.isort.cfg b/.isort.cfg index fdab6b9..d7aeec1 100644 --- a/.isort.cfg +++ b/.isort.cfg @@ -10,3 +10,6 @@ import_heading_firstparty=cisagov Libraries known_third_party=dns,docopt,ipwhois,pytest,schema,setuptools,tqdm,validators # These must be manually set to correctly separate them from third party libraries known_first_party=findcdn + +# Run isort under the black profile to align with our other Python linting +profile=black diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d8d000c..08b0935 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -5,7 +5,7 @@ default_language_version: repos: - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v2.5.0 + rev: v3.1.0 hooks: - id: check-executables-have-shebangs - id: check-json @@ -27,7 +27,7 @@ repos: - id: requirements-txt-fixer - id: trailing-whitespace - repo: https://github.com/igorshubovych/markdownlint-cli - rev: v0.23.0 + rev: v0.23.2 hooks: - id: markdownlint args: @@ -41,13 +41,13 @@ repos: hooks: - id: shell-lint - repo: https://gitlab.com/pycqa/flake8 - rev: 3.8.1 + rev: 3.8.3 hooks: - id: flake8 additional_dependencies: - flake8-docstrings - repo: https://github.com/asottile/pyupgrade - rev: v2.4.1 + rev: v2.7.0 hooks: - id: pyupgrade # Run bandit on "tests" tree with a configuration @@ -71,20 +71,20 @@ repos: hooks: - id: black - repo: https://github.com/asottile/seed-isort-config - rev: v2.1.1 + rev: v2.2.0 hooks: - id: seed-isort-config - repo: https://github.com/timothycrosley/isort - rev: 4.3.21 + rev: 5.0.7 hooks: - id: isort - repo: https://github.com/ansible/ansible-lint.git - rev: v4.3.0a0 + rev: v4.3.0a3 hooks: - id: ansible-lint # files: molecule/default/playbook.yml - repo: https://github.com/antonbabenko/pre-commit-terraform.git - rev: v1.30.0 + rev: v1.31.0 hooks: - id: terraform_fmt # There are ongoing issues with how this command works. This issue @@ -104,7 +104,7 @@ repos: # Terraform 0.13. # - id: terraform_validate - repo: https://github.com/IamTheFij/docker-pre-commit - rev: v1.0.1 + rev: v2.0.0 hooks: - id: docker-compose-check - repo: https://github.com/prettier/prettier @@ -112,6 +112,6 @@ repos: hooks: - id: prettier - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.770 + rev: v0.782 hooks: - id: mypy diff --git a/src/findcdn/cdnEngine/cdnEngine.py b/src/findcdn/cdnEngine/cdnEngine.py index 4db350d..36519c9 100755 --- a/src/findcdn/cdnEngine/cdnEngine.py +++ b/src/findcdn/cdnEngine/cdnEngine.py @@ -16,6 +16,7 @@ # Third-Party Libraries from tqdm import tqdm + # Internal Libraries from . import detectCDN diff --git a/src/findcdn/cdnEngine/detectCDN/cdn_check.py b/src/findcdn/cdnEngine/detectCDN/cdn_check.py index 0815865..e68c38c 100755 --- a/src/findcdn/cdnEngine/detectCDN/cdn_check.py +++ b/src/findcdn/cdnEngine/detectCDN/cdn_check.py @@ -10,20 +10,19 @@ from http.client import RemoteDisconnected from ssl import CertificateError, SSLError from typing import List +from urllib import request as request from urllib.error import URLError -import urllib.request as request # Third-Party Libraries +from dns.resolver import NXDOMAIN, NoAnswer, NoNameservers, Resolver, Timeout, query from ipwhois import HTTPLookupError, IPDefinedError, IPWhois from ipwhois.exceptions import ASNRegistryError + # Internal Libraries from .cdn_config import COMMON, CDNs, CDNs_rev from .cdn_err import NoIPaddress -from dns.resolver import NXDOMAIN, NoAnswer, NoNameservers # isort:skip -from dns.resolver import Resolver, Timeout, query # isort:skip - # Global variables LIFETIME = 10 diff --git a/src/findcdn/findcdn.py b/src/findcdn/findcdn.py index 38721cc..14ab714 100755 --- a/src/findcdn/findcdn.py +++ b/src/findcdn/findcdn.py @@ -42,12 +42,11 @@ from schema import And, Or, Schema, SchemaError, Use import validators + # Internal Libraries from ._version import __version__ from .cdnEngine import run_checks - -from .findcdn_err import FileWriteError, InvalidDomain, NoDomains # isort:skip -from .findcdn_err import OutputFileExists # isort:skip +from .findcdn_err import FileWriteError, InvalidDomain, NoDomains, OutputFileExists # Global Variables USER_AGENT = "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.1916.47 Safari/537.36"