From fce6ef84184f6750f6cf131e6dcb1e63cf49c2e5 Mon Sep 17 00:00:00 2001 From: Ole Martin Handeland Date: Mon, 1 Jun 2026 13:54:34 +0200 Subject: [PATCH] Revert "Commit hook: Warn about files with significant changes in next (#4095)" This reverts commit 4aa5f379193b408d917243d92dd87e41c9894651. --- .husky/pre-commit | 1 - .husky/pre-commit-check-monorepo-paths | 65 -------------------------- 2 files changed, 66 deletions(-) delete mode 100755 .husky/pre-commit-check-monorepo-paths diff --git a/.husky/pre-commit b/.husky/pre-commit index c2e2a4c50d..26ad00ceef 100755 --- a/.husky/pre-commit +++ b/.husky/pre-commit @@ -2,5 +2,4 @@ cd "$(dirname -- "$0")" cd ../ -sh .husky/pre-commit-check-monorepo-paths npx lint-staged diff --git a/.husky/pre-commit-check-monorepo-paths b/.husky/pre-commit-check-monorepo-paths deleted file mode 100755 index 022c33c5bd..0000000000 --- a/.husky/pre-commit-check-monorepo-paths +++ /dev/null @@ -1,65 +0,0 @@ -#!/usr/bin/env sh - -MONOREPO_PATHS_URL="https://raw.githubusercontent.com/Altinn/altinn-studio/refs/heads/main/src/App/frontend/monorepo-changed-paths.txt" - -# Try to fetch the file (5 second timeout, fail silently if unavailable) -if command -v curl > /dev/null 2>&1; then - MONOREPO_PATHS=$(curl -sf --max-time 5 "$MONOREPO_PATHS_URL" 2>/dev/null) -elif command -v wget > /dev/null 2>&1; then - MONOREPO_PATHS=$(wget -qO- --timeout=5 "$MONOREPO_PATHS_URL" 2>/dev/null) -else - exit 0 -fi - -[ -z "$MONOREPO_PATHS" ] && exit 0 - -# Get staged files, excluding yarn.lock -STAGED_FILES=$(git diff --cached --name-only | grep -v 'yarn\.lock') -[ -z "$STAGED_FILES" ] && exit 0 - -# Check staged files against each monorepo path (substring match) -MATCHING_FILES="" - -while IFS= read -r monorepo_path; do - [ -z "$monorepo_path" ] && continue - - matches=$(printf '%s\n' "$STAGED_FILES" | grep -F "$monorepo_path") - if [ -n "$matches" ]; then - while IFS= read -r match; do - case "$MATCHING_FILES" in - *"$match"*) ;; - *) MATCHING_FILES="${MATCHING_FILES}${match} -" - ;; - esac - done << MATCHES -$matches -MATCHES - fi -done << EOF -$MONOREPO_PATHS -EOF - -if [ -n "$MATCHING_FILES" ]; then - echo "" - echo "ERROR: You're changing files that have been significantly changed/refactored" - echo "in the monorepo (our next major version):" - echo "" - while IFS= read -r file; do - [ -z "$file" ] && continue - echo " $file" - done << FILES -$MATCHING_FILES -FILES - echo "" - echo "Make sure you have a plan for how to integrate these changes in the next major version," - echo "always add tests for the functionality you are changing, and ask in" - echo "#task-force-frontend-next on Slack if unsure." - echo "" - echo "To skip this check, commit without hooks:" - echo " git commit --no-verify" - echo "" - exit 1 -fi - -exit 0