diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..b05a9ee --- /dev/null +++ b/.editorconfig @@ -0,0 +1,10 @@ +# editorconfig.org +root = true + +[*] +indent_style = space +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true +indent_size = 2 diff --git a/.flake8 b/.flake8 new file mode 100644 index 0000000..7a4edca --- /dev/null +++ b/.flake8 @@ -0,0 +1,7 @@ +# https://flake8.pycqa.org/en/latest/user/configuration.html#configuration-locations +# + +# https://github.com/psf/black/blob/master/docs/the_black_code_style.md#line-length +[flake8] +# black wraps at 88 +max-line-length = 90 +extend-ignore = E203 diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..7fd0f73 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +# make github collapse diffs for generated files within PRs +# https://github.com/github/linguist#generated-code + +# make github know about vendored code +# https://github.com/github/linguist#vendored-code +**/vendor/** linguist-vendored + +# OWNERS files are YAML +OWNERS linguist-language=Yaml +**/OWNERS linguist-language=Yaml +OWNERS_ALIASES linguist-language=Yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..08afe93 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,11 @@ +--- +version: 2 +updates: + - package-ecosystem: pip + directory: /ci + schedule: + interval: daily + - package-ecosystem: pip + directory: /python + schedule: + interval: daily diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 0000000..c1783eb --- /dev/null +++ b/.pre-commit-config.yaml @@ -0,0 +1,80 @@ +--- +# See https://pre-commit.com for more information +# See https://pre-commit.com/hooks.html for more hooks + +# ignore: +# vendor'd code (that has vendor in its path) +exclude: vendor + +repos: + - repo: https://github.com/adrienverge/yamllint + rev: v1.25.0 + hooks: + - id: yamllint + args: + - --format=parsable + - --strict + + - repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt + rev: 0.1.0 # or higher tag + hooks: + - id: yamlfmt + args: + - --mapping=2 + - --sequence=4 + - --offset=2 + - --width=1200 # match .yamllint.yaml; we don't care about line-length. + exclude: repocop.yaml + + - repo: https://github.com/pre-commit/pre-commit-hooks + rev: v3.3.0 + hooks: + - id: check-added-large-files + - id: check-byte-order-marker + - id: check-case-conflict + - id: check-executables-have-shebangs + - id: check-json + - id: check-merge-conflict + - id: check-symlinks + - id: detect-private-key + - id: end-of-file-fixer + - id: forbid-new-submodules + - id: mixed-line-ending + - id: pretty-format-json + args: + - --autofix + - id: trailing-whitespace + + - repo: https://github.com/syntaqx/git-hooks + rev: v0.0.16 + hooks: + - id: forbid-binary + # Exclude png and server.zip forbid, we can check these in. + exclude: ^.+\.(png|server\.zip)$ + # See checks in shellcheck wiki: https://github.com/koalaman/shellcheck/wiki/ + - id: shellcheck + - id: shfmt + # do not use these args (yet): + # -s, simplify code + # -mn, minify to reduce its size + args: + - -w # autofix in place + - -d # show diff + - -i=2 # indent 2 spaces + + - repo: https://github.com/PyCQA/pylint + rev: pylint-2.6.0 + hooks: + - id: pylint + + - repo: https://gitlab.com/pycqa/flake8 + rev: 3.8.4 + hooks: + - id: flake8 + + - repo: https://github.com/psf/black + rev: 20.8b1 + hooks: + - id: black + args: + - --skip-string-normalization diff --git a/.yamllint.yaml b/.yamllint.yaml new file mode 100644 index 0000000..6b2085f --- /dev/null +++ b/.yamllint.yaml @@ -0,0 +1,18 @@ +--- +# https://yamllint.readthedocs.io/en/stable/configuration.html#default-configuration +extends: default + +yaml-files: + - .toolsharerc + - .yamllint.yaml + - '*.yaml' + - '*.yml' + - OWNERS_ALIASES + - OWNERS + +rules: + document-start: + level: error + line-length: + max: 1200 + level: warning diff --git a/ci/requirements.txt b/ci/requirements.txt index 97c9348..5d0190c 100644 --- a/ci/requirements.txt +++ b/ci/requirements.txt @@ -1,2 +1,3 @@ +pre-commit==2.7.1 pytest==4.5.0 pylint==2.3.1