Skip to content

Commit

Permalink
Add pre-commit config, incl. fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
MatthijsBurgh committed Oct 23, 2024
1 parent 34a003b commit 3a3675f
Show file tree
Hide file tree
Showing 7 changed files with 91 additions and 9 deletions.
77 changes: 77 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
ci:
# autofix_commit_msg: |
# [pre-commit.ci] auto fixes from pre-commit.com hooks
#
# for more information, see https://pre-commit.ci
autofix_prs: false
autoupdate_branch: ""
autoupdate_commit_msg: '[pre-commit.ci] pre-commit autoupdate'
autoupdate_schedule: weekly
skip: []
submodules: false

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v5.0.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-builtin-literals
# - id: check-case-conflict
- id: check-docstring-first
- id: check-executables-have-shebangs
# - id: check-illegal-windows-names
- id: check-json
- id: check-merge-conflict
- id: check-shebang-scripts-are-executable
exclude: '(^setup\.bash$|^setup/tue-data.bash$|^setup/tue-env.bash$|^setup/tue-functions.bash$|^setup/tue-misc.bash$)'
- id: check-symlinks
- id: check-toml
- id: check-vcs-permalinks
- id: check-xml
- id: check-yaml
- id: debug-statements
- id: destroyed-symlinks
# - id: detect-aws-credentials
- id: detect-private-key
# - id: double-quote-string-fixer
- id: end-of-file-fixer
# - id: file-contents-sorter
# files: []
- id: fix-byte-order-marker
- id: fix-encoding-pragma
args: [--remove]
# - id: forbid-new-submodules
# - id: forbid-submodules
- id: mixed-line-ending
args: ["--fix", "no"]
# - id: name-tests-test
# args: [
# "--pytest-test-first" # test_.*\.py
# # "--pytest" # .*_test\.py
# # "--unittest" # test.*\.py
# ]
- id: no-commit-to-branch
- id: pretty-format-json
# - id: requirements-txt-fixer
# - id: sort-simple-yaml
# files: []
- id: trailing-whitespace
args: [--markdown-linebreak-ext=md]

- repo: https://github.com/psf/black
rev: 24.10.0
hooks:
- id: black
args: [--check, --diff, --color]

- repo: https://github.com/shellcheck-py/shellcheck-py
rev: v0.10.0.1
hooks:
- id: shellcheck
files: '\S\.(bash|sh)'

- repo: https://github.com/pre-commit-ci/pre-commit-ci-config
rev: v1.6.1
hooks:
- id: check-pre-commit-ci-config
10 changes: 5 additions & 5 deletions ci/azure_commit_range.py
100644 → 100755
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#! /usr/bin/env python3

import json
import os
import sys
from urllib.request import urlopen

"""
Script to determine the commit range of a build in azure pipelines.
Expand All @@ -15,6 +10,11 @@
If the range is just 1 commit, an empty string is printed.
"""

import json
import os
import sys
from urllib.request import urlopen

TEAM_FOUNDATION_URI = os.getenv("SYSTEM_TEAMFOUNDATIONCOLLECTIONURI")
TEAM_PROJECT = os.getenv("SYSTEM_TEAMPROJECT")
BUILD_ID = os.getenv("BUILD_BUILDID")
Expand Down
Empty file modified ci/organization-packages.sh
100644 → 100755
Empty file.
Empty file modified installer/lsb_release.py
100644 → 100755
Empty file.
4 changes: 2 additions & 2 deletions installer/tue-get-dep.bash
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function _show_dep
fi

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

if [ -n "$2" ]
then
Expand All @@ -34,7 +34,7 @@ function _show_dep
else
if [ -n "$LEVEL" ]
then
if [[ $indent > $LEVEL ]]
if [[ ${indent} -gt ${LEVEL} ]]
then
return
fi
Expand Down
3 changes: 3 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[tool.black]
line-length = 120
target-version = ["py38"]
6 changes: 4 additions & 2 deletions setup/tue-env-config.bash
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ function tue-env-set
echo -e "[tue-env](config) Environment '${tue_env}' has '${option}' set to '${value}'"
}

function _main
function _tue-env-config-main
{
if [ -z "$1" ]
then
Expand Down Expand Up @@ -190,4 +190,6 @@ function _main
fi
}
_main "$@"
_tue-env-config-main "$@"
unset -f _tue-env-config-main

0 comments on commit 3a3675f

Please sign in to comment.