Use pre-commit as lint command

This commit is contained in:
Hasan Ramezani 2022-03-09 11:19:38 +01:00 committed by François Magimel
parent 0499dfa4c8
commit dad4fb893b
2 changed files with 17 additions and 20 deletions

View file

@ -18,22 +18,23 @@ from importlib.metadata import version
# documentation root, use os.path.abspath to make it absolute, like shown here.
# Add sources folder
sys.path.insert(0, os.path.abspath('../../'))
sys.path.insert(0, os.path.abspath("../../"))
# Setup Django for autodoc
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'auditlog_tests.test_settings')
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "auditlog_tests.test_settings")
import django
django.setup()
# -- Project information -----------------------------------------------------
project = 'django-auditlog'
author = 'Jan-Jelle Kester and contributors'
copyright = f'2013-{date.today().year}, {author}'
project = "django-auditlog"
author = "Jan-Jelle Kester and contributors"
copyright = f"2013-{date.today().year}, {author}"
release = version('django-auditlog')
release = version("django-auditlog")
# for example take major/minor
version = '.'.join(release.split('.')[:2])
version = ".".join(release.split(".")[:2])
# -- General configuration ---------------------------------------------------
@ -41,27 +42,27 @@ version = '.'.join(release.split('.')[:2])
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = [
'sphinx.ext.autodoc',
'sphinx.ext.viewcode',
"sphinx.ext.autodoc",
"sphinx.ext.viewcode",
]
# Master document that contains the root table of contents
master_doc = 'index'
master_doc = "index"
# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']
templates_path = ["_templates"]
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
# -- Options for HTML output -------------------------------------------------
# The theme to use for HTML and HTML Help pages. See the documentation for
# a list of builtin themes.
#
html_theme = 'sphinx_rtd_theme'
html_theme = "sphinx_rtd_theme"
# 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,

10
tox.ini
View file

@ -37,14 +37,10 @@ changedir = docs/source
deps = -rdocs/requirements.txt
commands = sphinx-build -W -b html -d {envtmpdir}/doctrees . {envtmpdir}/html
[testenv:py38-qa]
basepython = python3.8
deps =
black
isort
[testenv:lint]
deps = pre-commit
commands =
black --check --diff auditlog auditlog_tests setup.py runtests.py
isort --check-only --diff auditlog auditlog_tests setup.py runtests.py
pre-commit run --all-files
[gh-actions]
python =