Skip to content

Commit

Permalink
Merge branch 'main' into CCM-6104-AMET-Structure
Browse files Browse the repository at this point in the history
  • Loading branch information
aidenvaines-bjss authored Sep 3, 2024
2 parents 8c34b83 + 61b18d1 commit 8e2c839
Show file tree
Hide file tree
Showing 4 changed files with 62 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ act 0.2.64
gitleaks 8.18.4
pre-commit 3.6.0
terraform 1.9.2
vale 3.6.0
tfsec 1.28.10
vale 3.6.0

# ==============================================================================
# The section below is reserved for Docker image versions.
Expand Down
6 changes: 6 additions & 0 deletions scripts/config/gitleaks.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,9 @@ paths = [
'''yarn.lock''',
'''Gemfile.lock''',
]

# Exclude Chrome version in user agent
regexTarget = "line"
regexes = [
'''Chrome/[\d.]+'''
]
7 changes: 7 additions & 0 deletions scripts/config/pre-commit.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ repos:
- id: pretty-format-json
args: ['--autofix']
# - id: ...
- repo: local
hooks:
- id: sort-dictionary
name: Sort dictionary
entry: ./scripts/githooks/sort-dictionary.sh
language: script
pass_filenames: false
- repo: local
hooks:
- id: scan-secrets
Expand Down
48 changes: 48 additions & 0 deletions scripts/githooks/sort-dictionary.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#!/bin/bash

set -euo pipefail

# Pre-commit git hook to sort the Vale dictionary in a consistent manner to avoid future merge conflicts and aid insertion of new terms
#
# Usage:
# $ [options] ./sort-dictionary.sh
#
# Options:
#
#
# Exit codes:
# 0 - Successfully sorted the dictionary
# non-zero - failed to sort dictionary

# ==============================================================================

function main() {
root=scripts/config/vale/styles/config/vocabularies/words
opts="--dictionary-order --ignore-case -s"
sort $opts $root/accept.txt > $root/accept.sorted.txt
sort $opts $root/reject.txt > $root/reject.sorted.txt

mv $root/accept.sorted.txt $root/accept.txt
mv $root/reject.sorted.txt $root/reject.txt

git add -uv $root/*
}

# ==============================================================================

function is-arg-true() {

if [[ "$1" =~ ^(true|yes|y|on|1|TRUE|YES|Y|ON)$ ]]; then
return 0
else
return 1
fi
}

# ==============================================================================

is-arg-true "${VERBOSE:-false}" && set -x

main "$@"

exit 0

0 comments on commit 8e2c839

Please sign in to comment.