diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8f4e04d..2c31010 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -6,11 +6,22 @@ repos: - id: end-of-file-fixer - id: check-yaml - id: check-added-large-files + - id: fix-encoding-pragma + - id: detect-private-key + - id: check-merge-conflict + - id: check-case-conflict + - id: check-docstring-first + - id: check-builtin-literals - repo: https://github.com/psf/black rev: 19.3b0 hooks: - id: black +- repo: https://github.com/pre-commit/mirrors-isort + rev: v5.7.0 + hooks: + - id: isort + - repo: https://gitlab.com/pycqa/flake8 rev: 3.8.1 hooks: diff --git a/aprsd/client.py b/aprsd/client.py index 9f256c7..281c830 100644 --- a/aprsd/client.py +++ b/aprsd/client.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import logging import select import socket diff --git a/aprsd/email.py b/aprsd/email.py index 85110df..f7084bc 100644 --- a/aprsd/email.py +++ b/aprsd/email.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import datetime import email import imaplib diff --git a/aprsd/fake_aprs.py b/aprsd/fake_aprs.py index 3472feb..086a7e4 100644 --- a/aprsd/fake_aprs.py +++ b/aprsd/fake_aprs.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import argparse import logging import socketserver diff --git a/aprsd/fuzzyclock.py b/aprsd/fuzzyclock.py index 19f105b..ba92596 100644 --- a/aprsd/fuzzyclock.py +++ b/aprsd/fuzzyclock.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # # @author Sinu John # sinuvian at gmail dot com diff --git a/aprsd/messaging.py b/aprsd/messaging.py index 34627f3..fd6cd4d 100644 --- a/aprsd/messaging.py +++ b/aprsd/messaging.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import abc import datetime import logging diff --git a/aprsd/plugin.py b/aprsd/plugin.py index b7f350b..aab9ac3 100644 --- a/aprsd/plugin.py +++ b/aprsd/plugin.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # The base plugin class import abc import fnmatch diff --git a/aprsd/threads.py b/aprsd/threads.py index e352bf9..31fca98 100644 --- a/aprsd/threads.py +++ b/aprsd/threads.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import abc import logging import queue diff --git a/aprsd/utils.py b/aprsd/utils.py index f92c7d9..4257ac9 100644 --- a/aprsd/utils.py +++ b/aprsd/utils.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- """Utilities and helper functions.""" import errno diff --git a/dev-requirements.in b/dev-requirements.in index dcd980a..51e6336 100644 --- a/dev-requirements.in +++ b/dev-requirements.in @@ -1,9 +1,9 @@ -tox +black +flake8 +isort +mypy pytest pytest-cov -mypy -flake8 pep8-naming -black -isort Sphinx +tox diff --git a/examples/plugins/example_plugin.py b/examples/plugins/example_plugin.py index c4eb1d0..e01281e 100644 --- a/examples/plugins/example_plugin.py +++ b/examples/plugins/example_plugin.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- import logging from aprsd import plugin diff --git a/setup.py b/setup.py index 90623e2..fda5a1c 100644 --- a/setup.py +++ b/setup.py @@ -1,3 +1,4 @@ +# -*- coding: utf-8 -*- # Copyright (c) 2013 Hewlett-Packard Development Company, L.P. # # Licensed under the Apache License, Version 2.0 (the "License"); diff --git a/tox.ini b/tox.ini index ba64524..dd53ec5 100644 --- a/tox.ini +++ b/tox.ini @@ -2,7 +2,7 @@ minversion = 2.9.0 skipdist = True skip_missing_interpreters = true -envlist = pep8,py{36,37,38},fmt-check +envlist = pre-commit,pep8,fmt-check,py{36,37,38} # Activate isolated build environment. tox will use a virtual environment # to build a source distribution from the source tree. For build tools and @@ -91,3 +91,8 @@ deps = -r{toxinidir}/dev-requirements.txt commands = mypy aprsd + +[testenv:pre-commit] +skip_install = true +deps = pre-commit +commands = pre-commit run --all-files --show-diff-on-failure