Skip to content
Snippets Groups Projects
Commit fde4b49f authored by Bastien Abadie's avatar Bastien Abadie
Browse files

Base CI setup

parent cda89d66
No related branches found
No related tags found
No related merge requests found
Pipeline #77811 passed
[flake8]
max-line-length = 150
exclude = .git,__pycache__
ignore = E203,E501,W503
stages:
- test
- build
- release
lint:
image: python:3
cache:
paths:
- .cache/pip
- .cache/pre-commit
variables:
PIP_CACHE_DIR: "$CI_PROJECT_DIR/.cache/pip"
PRE_COMMIT_HOME: "$CI_PROJECT_DIR/.cache/pre-commit"
before_script:
- pip install pre-commit
script:
- pre-commit run -a
[settings]
# Compatible with black
multi_line_output = 3
include_trailing_comma = True
force_grid_wrap = 0
use_parentheses = True
line_length = 88
default_section=FIRSTPARTY
known_first_party = arkindex,arkindex_common
known_third_party =
repos:
- repo: https://github.com/asottile/seed-isort-config
rev: v2.2.0
hooks:
- id: seed-isort-config
- repo: https://github.com/pre-commit/mirrors-isort
rev: v4.3.21
hooks:
- id: isort
- repo: https://github.com/ambv/black
rev: stable
hooks:
- id: black
- repo: https://gitlab.com/pycqa/flake8
rev: 3.8.3
hooks:
- id: flake8
additional_dependencies:
- 'flake8-coding==1.3.1'
- 'flake8-copyright==0.2.2'
- 'flake8-debugger==3.1.0'
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.1.0
hooks:
- id: check-ast
- id: check-docstring-first
- id: check-executables-have-shebangs
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: trailing-whitespace
- id: check-yaml
args: [--allow-multiple-documents]
- id: mixed-line-ending
- id: name-tests-test
args: ['--django']
- id: check-json
- id: requirements-txt-fixer
- repo: https://github.com/codespell-project/codespell
rev: v1.17.1
hooks:
- id: codespell
args: ['--write-changes']
- repo: meta
hooks:
- id: check-useless-excludes
default_language_version:
python: python3.7
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# File generated by pre-commit: https://pre-commit.com
# ID: 138fd403232d2ddd5efb44317e38bf03
import os
import sys
# we try our best, but the shebang of this script is difficult to determine:
# - macos doesn't ship with python3
# - windows executables are almost always `python.exe`
# therefore we continue to support python2 for this small script
if sys.version_info < (3, 3):
from distutils.spawn import find_executable as which
else:
from shutil import which
# work around https://github.com/Homebrew/homebrew-core/issues/30445
os.environ.pop("__PYVENV_LAUNCHER__", None)
# start templated
INSTALL_PYTHON = "/usr/bin/python3"
ARGS = [
"hook-impl",
"--config=.pre-commit-config.yaml",
"--hook-type=pre-commit",
"--skip-on-missing-config",
]
# end templated
ARGS.extend(("--hook-dir", os.path.realpath(os.path.dirname(__file__))))
ARGS.append("--")
ARGS.extend(sys.argv[1:])
DONE = "`pre-commit` not found. Did you forget to activate your virtualenv?"
if os.access(INSTALL_PYTHON, os.X_OK):
CMD = [INSTALL_PYTHON, "-mpre_commit"]
elif which("pre-commit"):
CMD = ["pre-commit"]
else:
raise SystemExit(DONE)
CMD.extend(ARGS)
if sys.platform == "win32": # https://bugs.python.org/issue19124
import subprocess
if sys.version_info < (3, 7): # https://bugs.python.org/issue25942
raise SystemExit(subprocess.Popen(CMD).wait())
else:
raise SystemExit(subprocess.call(CMD))
else:
os.execvp(CMD[0], CMD)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment