Skip to content

Commit 3a3675f

Browse files
committed
Add pre-commit config, incl. fixes
1 parent 34a003b commit 3a3675f

7 files changed

+91
-9
lines changed

.pre-commit-config.yaml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
ci:
2+
# autofix_commit_msg: |
3+
# [pre-commit.ci] auto fixes from pre-commit.com hooks
4+
#
5+
# for more information, see https://pre-commit.ci
6+
autofix_prs: false
7+
autoupdate_branch: ""
8+
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
9+
autoupdate_schedule: weekly
10+
skip: []
11+
submodules: false
12+
13+
repos:
14+
- repo: https://github.com/pre-commit/pre-commit-hooks
15+
rev: v5.0.0
16+
hooks:
17+
- id: check-added-large-files
18+
- id: check-ast
19+
- id: check-builtin-literals
20+
# - id: check-case-conflict
21+
- id: check-docstring-first
22+
- id: check-executables-have-shebangs
23+
# - id: check-illegal-windows-names
24+
- id: check-json
25+
- id: check-merge-conflict
26+
- id: check-shebang-scripts-are-executable
27+
exclude: '(^setup\.bash$|^setup/tue-data.bash$|^setup/tue-env.bash$|^setup/tue-functions.bash$|^setup/tue-misc.bash$)'
28+
- id: check-symlinks
29+
- id: check-toml
30+
- id: check-vcs-permalinks
31+
- id: check-xml
32+
- id: check-yaml
33+
- id: debug-statements
34+
- id: destroyed-symlinks
35+
# - id: detect-aws-credentials
36+
- id: detect-private-key
37+
# - id: double-quote-string-fixer
38+
- id: end-of-file-fixer
39+
# - id: file-contents-sorter
40+
# files: []
41+
- id: fix-byte-order-marker
42+
- id: fix-encoding-pragma
43+
args: [--remove]
44+
# - id: forbid-new-submodules
45+
# - id: forbid-submodules
46+
- id: mixed-line-ending
47+
args: ["--fix", "no"]
48+
# - id: name-tests-test
49+
# args: [
50+
# "--pytest-test-first" # test_.*\.py
51+
# # "--pytest" # .*_test\.py
52+
# # "--unittest" # test.*\.py
53+
# ]
54+
- id: no-commit-to-branch
55+
- id: pretty-format-json
56+
# - id: requirements-txt-fixer
57+
# - id: sort-simple-yaml
58+
# files: []
59+
- id: trailing-whitespace
60+
args: [--markdown-linebreak-ext=md]
61+
62+
- repo: https://github.com/psf/black
63+
rev: 24.10.0
64+
hooks:
65+
- id: black
66+
args: [--check, --diff, --color]
67+
68+
- repo: https://github.com/shellcheck-py/shellcheck-py
69+
rev: v0.10.0.1
70+
hooks:
71+
- id: shellcheck
72+
files: '\S\.(bash|sh)'
73+
74+
- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
75+
rev: v1.6.1
76+
hooks:
77+
- id: check-pre-commit-ci-config

ci/azure_commit_range.py

100644100755
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
11
#! /usr/bin/env python3
22

3-
import json
4-
import os
5-
import sys
6-
from urllib.request import urlopen
7-
83
"""
94
Script to determine the commit range of a build in azure pipelines.
105
@@ -15,6 +10,11 @@
1510
If the range is just 1 commit, an empty string is printed.
1611
"""
1712

13+
import json
14+
import os
15+
import sys
16+
from urllib.request import urlopen
17+
1818
TEAM_FOUNDATION_URI = os.getenv("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI")
1919
TEAM_PROJECT = os.getenv("SYSTEM_TEAMPROJECT")
2020
BUILD_ID = os.getenv("BUILD_BUILDID")

ci/organization-packages.sh

100644100755
File mode changed.

installer/lsb_release.py

100644100755
File mode changed.

installer/tue-get-dep.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ function _show_dep
2121
fi
2222

2323
local indent_str
24-
indent_str=$(perl -E 'say "--" x '$indent)
24+
indent_str=$(perl -E 'say "--" x '"${indent}")
2525

2626
if [ -n "$2" ]
2727
then
@@ -34,7 +34,7 @@ function _show_dep
3434
else
3535
if [ -n "$LEVEL" ]
3636
then
37-
if [[ $indent > $LEVEL ]]
37+
if [[ ${indent} -gt ${LEVEL} ]]
3838
then
3939
return
4040
fi

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[tool.black]
2+
line-length = 120
3+
target-version = ["py38"]

setup/tue-env-config.bash

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ function tue-env-set
150150
echo -e "[tue-env](config) Environment '${tue_env}' has '${option}' set to '${value}'"
151151
}
152152

153-
function _main
153+
function _tue-env-config-main
154154
{
155155
if [ -z "$1" ]
156156
then
@@ -190,4 +190,6 @@ function _main
190190
fi
191191
}
192192
193-
_main "$@"
193+
_tue-env-config-main "$@"
194+
195+
unset -f _tue-env-config-main

0 commit comments

Comments
 (0)