Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
1776d55
chore: ignores local TODO files
jonrandahl Feb 3, 2026
ead1fd1
feat(images): add accredited statistics logo
jonrandahl Feb 3, 2026
eba8ed1
feat(ui): Adds accredited statistic logo
jonrandahl Feb 3, 2026
191ed8b
feat(i18n): adds accredited statistic translation
jonrandahl Feb 3, 2026
cadc8ed
feat(ui): repositions accredited statistic logo
jonrandahl Feb 3, 2026
50b4b3c
style(ui): migrate padding to skip link
jonrandahl Feb 3, 2026
7cdec20
style(ui): improves cookie banner style
jonrandahl Feb 3, 2026
3a82ea8
Style(ui): improves layout and styling consistency
jonrandahl Feb 3, 2026
150a3b6
feat(ukhpi): refactor header styling and structure
jonrandahl Feb 3, 2026
81321a7
chore(build): refactors Makefile for improved automation
jonrandahl Feb 3, 2026
cad7e77
feat(i18n): dynamically load accredited statistic logo by locale
jonrandahl Feb 4, 2026
7c8d854
chore(images): replaces logo images
jonrandahl Feb 4, 2026
8fe6ade
chore(deps): update caniuse-lite and baseline-browser-mapping
jonrandahl Feb 4, 2026
14bcf54
feat(ui): add Welsh accredited official statistics logo in SVG format
jonrandahl Feb 4, 2026
532c84e
feat(ui): updates accredited logo link
jonrandahl Feb 4, 2026
8951f3c
feat(ui): adds accredited statistics section
jonrandahl Feb 4, 2026
36340ae
chore(build): update githooks for code quality checks
jonrandahl Feb 4, 2026
fe98fb7
feat(dev): improve application start-up
jonrandahl Feb 4, 2026
f814ced
style(ci): refine rubocop rules
jonrandahl Feb 5, 2026
580a296
refactor(styles): extracts header and footer styles
jonrandahl Feb 5, 2026
2f0d624
style(ui): improves header responsiveness
jonrandahl Feb 5, 2026
2f9a237
style(ui): Uses lr-common variables
jonrandahl Feb 5, 2026
f5e2c80
refactor: improve server boot information logging
jonrandahl Feb 5, 2026
e3a55c6
docs: updated CHANGELOG
jonrandahl Feb 6, 2026
326f219
Issue: 571-Implement accredited statistic logo (#572)
jonrandahl Feb 6, 2026
946a74f
chore(ui): update accredited stats copy
jonrandahl Feb 10, 2026
accf9f5
chore(ui): update accredited stats copy (#573)
jonrandahl Feb 11, 2026
8ba4441
Update CHANGELOG for version 2.3.0
jonrandahl Feb 11, 2026
09a5bca
Bump version to 2.3.0
jonrandahl Feb 11, 2026
1958776
Task: Release candidate v2.3.0 (#575)
jonrandahl Feb 11, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions .githooks/common.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#!/bin/bash
# Common utilities and functions for git hooks
#
# Environment variables:
# NO_COLOR - Set to any value to disable colored output (e.g., NO_COLOR=1 git commit)

# Check if color output is disabled (set NO_COLOR=1 to disable)
: "${NO_COLOR:=}"

# Initialize branch name from filtered branch list
init_branch_name() {
local list="issue spike task"
local listRE="^($(printf '%s\n' "$list" | tr ' ' '|'))/"

BRANCH_NAME=$(git branch --show-current | grep -E "$listRE" | sed 's/* //')
}

# Check if hook should be skipped based on branch, reflog action, or flags
should_skip_hook() {
# Skip on specific branches
if echo "$BRANCH_NAME" | grep -qE '^(hotfix|rebase|prod(uction)?)$'; then
return 0
fi

# Skip if Git reflog indicates an amend (reliable for GUI flows)
if [ "${GIT_REFLOG_ACTION:-}" = "commit (amend)" ]; then
return 0
fi

# Fallback: check parent process for --no-verify or --amend flags
local ppid_cmd
ppid_cmd=$(ps -ocommand= -p $PPID 2>/dev/null || echo "")
if [[ "$ppid_cmd" == *"--no-verify"* ]] || [[ "$ppid_cmd" == *"--amend"* ]]; then
return 0
fi

return 1
}

# Print colored status messages (respects NO_COLOR environment variable)
print_header() {
if [ -z "$NO_COLOR" ]; then
printf '\n\033[0;105m%s\033[0m\n' "$1"
else
printf '\n%s\n' "$1"
fi
}

print_success() {
if [ -z "$NO_COLOR" ]; then
printf '\n\033[0;32m%s\033[0m\n' "$1"
else
printf '\n%s\n' "$1"
fi
}

print_warning() {
if [ -z "$NO_COLOR" ]; then
printf '\n\033[0;33m%s\033[0m\n' "$1"
else
printf '\n%s\n' "$1"
fi
}

print_error() {
if [ -z "$NO_COLOR" ]; then
printf '\n\033[0;31m%s\033[0m\n' "$1"
else
printf '\n%s\n' "$1"
fi
}

print_info() {
if [ -z "$NO_COLOR" ]; then
printf '\033[0;33m%s\033[0m\n' "$1"
else
printf '%s\n' "$1"
fi
}
66 changes: 24 additions & 42 deletions .githooks/post-commit
Original file line number Diff line number Diff line change
Expand Up @@ -5,84 +5,66 @@
# aborted. The hook can be bypassed by using the --no-verify option
# when running "git commit".

# ! This could ask for user input to sign the commit as it's now using
# ! the `git commit` command instead of `git commit -m` which is
# ! the default behavior of the `git commit` command. This could be
# ! a problem if the user is not expecting it. This should be fixed
# ! in the future.
if [[ $(ps -ocommand= -p $PPID) == *"git"*"commit"*"--no-verify"* ]] || [[ $(ps -ocommand= -p $PPID) == *"git"*"commit"*"--amend"* ]]; then
printf '\n\033[0;33mSkipping post-commit hook on "%s"... 🤨\033[0m\n' "$BRANCH_NAME"
exit 0
fi

list="issue spike task"

listRE="^($(printf '%s\n' "$list" | tr ' ' '|'))/"
# Source common hook utilities
. "$(dirname "$0")/common.sh"

BRANCH_NAME=$(git branch --show-current | grep -E "$listRE" | sed 's/* //')
# Initialize branch name
init_branch_name

printf '\n\033[0;105mChecking "%s"... \033[0m\n' "$BRANCH_NAME"
print_header "Checking \"$BRANCH_NAME\"..."

if echo "$BRANCH_NAME" | grep -q '^(hotfix)|(rebase)|(production)*$'; then
printf '\n\033[0;33mSkipping post-commit hook on "%s"... 🤨\033[0m\n' "$BRANCH_NAME"
exit 0
# Skip if on specific branches, or when amending or --no-verify flag is set
if should_skip_hook; then
print_warning "Skipping post-commit hook... 🤨"
exit 0
fi

# Check for existence of "new or modified" test files
NEW_TEST_FILES="$(git diff --diff-filter=ACDM --name-only --cached | grep -E '(./test/*)$')"
# Get all test files to run tests
CURRENT_TEST_FILES="$(git ls-files | grep -i -E '(_test\.rb)$')"

RAILS_TEST_EXIT_CODE=0
WORK_DONE=0

if [ -z "$NEW_TEST_FILES" ]; then
printf '\n\033[0;31mThere are currently no new tests found in "%s". 🤨\033[0m\n' "$BRANCH_NAME"
printf '\n\033[0;31mContinuing without new tests... 😖\033[0m\n'
fi

if [ -n "$NEW_TEST_FILES" ]; then
#Count the number of new test files
file_count=$(echo "$NEW_TEST_FILES" | wc -l)
# Check if there are any new test files
if [ "$file_count" -ne 0 ]; then
printf '\n\033[0;33mFound %d new test files in "%s" 🎉.\033[0m\n' "$file_count" "$BRANCH_NAME"
print_warning "Found $file_count new test files in \"$BRANCH_NAME\" 🎉."
fi

for file in $NEW_TEST_FILES; do
# if file is system test file run rake test:system filename
if [[ "$file" == *"./test/system/*_test.rb" ]]; then
printf '\n\033[0;33mRunning system test for "%s"...\033[0m\n', "$file"
print_warning "Running system test for \"$file\"..."
bundle exec rake test:system "$file"
else
printf '\n\033[0;33mRunning unit test on "%s"...\033[0m\n', "$file"
print_warning "Running unit test on \"$file\"..."
bundle exec rake test "$file"
fi
# Capture the exit code from the test command to determine if it passed or failed
if [ $? -ne 0 ]; then
RAILS_TEST_EXIT_CODE=1
fi
done
RAILS_TEST_EXIT_CODE=$?
WORK_DONE=1
fi

if [ -n "$CURRENT_TEST_FILES" ] && [ "$WORK_DONE" -eq 0 ]; then
printf '\nRunning all Rails Tests ...\n'
elif [ -n "$CURRENT_TEST_FILES" ]; then
print_warning "No new tests found, running all Rails Tests ..."
make test
RAILS_TEST_EXIT_CODE=$?
WORK_DONE=1
else
RAILS_TEST_EXIT_CODE=0
print_error "No tests found in \"$BRANCH_NAME\". 🤨"
RAILS_TEST_EXIT_CODE=1
fi

if [ ! "$RAILS_TEST_EXIT_CODE" -eq 0 ]; then
git reset HEAD~
printf '\n\033[0;31mCannot commit, tests are failing. Use --no-verify to force commit. 😖\033[0m\n'
print_error "Cannot commit, tests are failing. Use --no-verify to force commit. 😖"
exit 1
fi

if [ "$WORK_DONE" -eq 1 ]; then
printf '\n\033[0;32mAll tests are green, committing... 🎉\033[0m\n'
exit 0
fi

if [ "$WORK_DONE" -eq 2 ]; then
printf '\n\033[0;41mCurrently skipping broken tests found on "%s". 🤨\033[0m\n' "$BRANCH_NAME"
exit 0
fi
print_success "All tests are green, committing... 🎉"
exit 0
43 changes: 22 additions & 21 deletions .githooks/pre-commit
Original file line number Diff line number Diff line change
Expand Up @@ -3,54 +3,55 @@
# beware if you are in the habit of committing only partial modifications to a file:
# THIS HOOK WILL ADD ALL MODIFICATIONS TO A FILE TO THE COMMIT IF ANY FILE WAS CHANGED BY LINTING

list="issue spike task"
# Source common hook utilities
. "$(dirname "$0")/common.sh"

listRE="^($(printf '%s\n' "$list" | tr ' ' '|'))/"
# Initialize branch name
init_branch_name

BRANCH_NAME=$(git branch --show-current | grep -E "$listRE" | sed 's/* //')
print_header "Checking \"$BRANCH_NAME\"..."

printf '\n\033[0;105mChecking "%s"... \033[0m\n' "$BRANCH_NAME"

if echo "$BRANCH_NAME" | grep -q '^(hotfix)|(rebase)|(production)*$'; then
printf '\n\033[0;33mSkipping pre-commit hook on "%s"... 🤨\033[0m\n' "$BRANCH_NAME"
if should_skip_hook; then
print_success "No checks necessary on \"$BRANCH_NAME\", pushing now... 🎉"
exit 0
fi

# Identify staged Ruby-related files (including Gemfile/Rakefile) to lint before commit.
RUBY_FILES="$(git diff --diff-filter=d --name-only --cached | grep -E '(Gemfile|Rakefile|\.(rb|rake|ru))$')"
PRE_STATUS="$(git status | wc -l)"

# Initialise exit code variables to track success (0 = success)
RUBOCOP_EXIT_CODE=0
WORK_DONE=0

if [ -z "$RUBY_FILES" ]; then
printf '\n\033[0;31mThere are currently no updated files in "%s". 🤨\033[0m\n' "$BRANCH_NAME"
fi

if [ -n "$RUBY_FILES" ]; then
printf '\n\033[0;33mRunning Rubocop...\033[0m\n'
for file in $RUBY_FILES; do
git show :"$file" | bundle exec rubocop -a --stdin "$file"
done
print_error "There are currently no updated files in \"$BRANCH_NAME\". 🤨"
else
print_warning "Running Rubocop..."
# Convert space-separated file list into positional parameters for safe argument passing
set -- $RUBY_FILES
# Execute RuboCop with auto-fix enabled on the staged files that have been set
bundle exec rubocop -a --force-exclusion -- "$@"
# Capture the exit code from RuboCop command (0 = success, non-zero = errors)
RUBOCOP_EXIT_CODE=$?
# Flag that linting ran so we can report result and re-add files if needed.
WORK_DONE=1
else
printf '\n\033[0;32mContinuing as there are no changes to check... 🎉\033[0m\n'
RUBOCOP_EXIT_CODE=0
fi

POST_STATUS="$(git status | wc -l)"

if [ ! $RUBOCOP_EXIT_CODE -eq 0 ]; then
git reset HEAD
printf '\n\033[0;31mLinting has uncorrectable errors; please fix and restage your commit. 😖\033[0m\n'
print_error "Linting has uncorrectable errors; please fix and restage your commit. 😖"
exit 1
fi

if [ "$PRE_STATUS" != "$POST_STATUS" ]; then
git add "$RUBY_FILES"
fi

if [ $WORK_DONE -eq 1 ]; then
printf '\n\033[0;32mLinting completed successfully! 🎉\033[0m\n'
if [ ! $WORK_DONE -eq 0 ]; then
print_success "Linting completed successfully! 🎉"
fi

exit 0
95 changes: 39 additions & 56 deletions .githooks/pre-push
Original file line number Diff line number Diff line change
@@ -1,81 +1,64 @@
#!/bin/bash
# Source common hook utilities
. "$(dirname "$0")/common.sh"

: "${CLIENT_PROFILE:=hmlr}"
: "${API_SERVICE_URL:=http://data-api:8080}"
: "${RUN_VARS:=--detach --publish}"

# Check if the script is being run in a Git repository
if ! git rev-parse --is-inside-work-tree &>/dev/null; then
printf '\n\033[0;31mThis script must be run inside a Git repository.\033[0m\n'
exit 1
fi
# Initialize branch name
init_branch_name

# Check if Docker is installed and running
if ! command -v docker &>/dev/null; then
printf '\n\033[0;31mDocker is not installed or not running. Please check Docker and try again.\033[0m\n'
exit 1
else
DOCKER_SERVER_VERSION=$(docker info -f json | jq -r '.ServerVersion')
if [ $? -eq 0 ]; then
printf "\n\033[0;32mDocker is installed and running at version ${DOCKER_SERVER_VERSION}. Proceeding with the checks... 🎉\033[0m\n"
else
printf '\n\033[0;31mDocker is installed but not running. Please start Docker and try again.\033[0m\n'
fi
fi
print_header "Checking \"$BRANCH_NAME\"..."

# The branch prefixes are defined in the list variable
# and can be modified as needed.
list="issue spike task"
# The list is converted to a regular expression
listRE="^($(printf '%s\n' "$list" | tr ' ' '|'))/"
# Set the branch name based on the current branch
# The branch name is extracted using grep and sed
# to match the branch prefixes.
BRANCH_NAME=$(git branch --show-current | grep -E "$listRE" | sed 's/* //')
# If the branch name is empty, it means the current branch
# does not match any of the prefixes.
printf '\n\033[0;105mChecking "%s"... \033[0m\n' "$BRANCH_NAME"
# If the branch name is one of the specified prefixes,
# skip the checks and exit with success.
if echo "$BRANCH_NAME" | grep -q '^(hotfix)|(rebase)|(production)*$'; then
printf '\n\033[0;32mNo checks necessary on "%s", skipping hooks... 🎉\033[0m\n' "$BRANCH_NAME"
exit 0
# Skip on specific branches, with --no-verify flag, or when amending
if should_skip_hook; then
print_success "Skipping pre-push hook... 🎉"
exit 0
fi

# Check for existence of "new or modified" files
DOCKER_BUILD_EXIT_CODE=0
DOCKER_RUN_EXIT_CODE=0

if ! git update-index -q --ignore-submodules --refresh; then
printf '\n\033[0;31mUp-to-date check failed😖\033[0m\n'
print_error "Up-to-date check failed 😖"
DOCKER_BUILD_EXIT_CODE=1
else
printf '\n\033[0;33mBuilding Docker image with "%s" profile... \033[0m\n' "$CLIENT_PROFILE"
print_warning "Building Docker image with \"$CLIENT_PROFILE\" profile... "
AWS_PROFILE=$CLIENT_PROFILE make image
DOCKER_BUILD_EXIT_CODE=$?
fi

# If the Docker image build fails, print an error message and exit with an error code.
if [ $DOCKER_BUILD_EXIT_CODE -ne 0 ]; then
printf '\n\033[0;31mDocker image build failed. Please check your changes. 😖\033[0m\n'
print_error "Docker image build failed. Please check your changes. 😖"
exit 1
else
printf '\n\033[0;32mDocker image build succeeded. 🎉\033[0m\n'
CONTAINER_ID=$(make name)
printf '\n\033[0;33mRunning Docker image %s ... \033[0m\n' "$CONTAINER_ID"
AWS_PROFILE=$CLIENT_PROFILE API_SERVICE_URL=$API_SERVICE_URL RUN_VARS=$RUN_VARS make run
secs=5
while [ $secs -gt -1 ]; do
echo -ne "$secs\033[0K\r"
sleep 1
: $((secs--))
done
docker inspect --format="{{.State.Running}}" "$CONTAINER_ID" | grep 'true' -q
DOCKER_RUN_EXIT_CODE=$?
printf '\n\033[0;33mStopping Docker image with exit code %s ... \033[0m\n' "$DOCKER_RUN_EXIT_CODE"
make stop
fi

# Build succeeded, now run the container
print_success "Docker image build succeeded. 🎉"
CONTAINER_ID=$(make name)
print_warning "Running Docker image $CONTAINER_ID ... "
AWS_PROFILE=$CLIENT_PROFILE API_SERVICE_URL=$API_SERVICE_URL RUN_VARS=$RUN_VARS make run

# Wait for container to stabilize
secs=5
while [ $secs -gt -1 ]; do
echo -ne "$secs\033[0K\r"
sleep 1
: $((secs--))
done

# Check if container is running
docker inspect --format="{{.State.Running}}" "$CONTAINER_ID" | grep 'true' -q
DOCKER_RUN_EXIT_CODE=$?

print_warning "Stopping Docker image with exit code $DOCKER_RUN_EXIT_CODE ... "
make stop

if [ $DOCKER_RUN_EXIT_CODE -ne 0 ]; then
printf '\n\033[0;31mDocker image run failed. Please check your changes. 😖\033[0m\n'
print_error "Docker image run failed. Please check your changes. 😖"
exit 1
else
printf '\n\033[0;32mDocker image run succeeded. 🎉\033[0m\n'
print_success "Docker image run succeeded. 🎉"
exit 0
fi
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -94,3 +94,6 @@ vite.config.js.timestamp-*-*.mjs
# Ignore local configuration files
.env*
!.env.development

# Ignore local TODO files
TODO.md
Loading