Browse Source

Maintenance: Split up overcommit custom script.

Martin Gruner 8 months ago
parent
commit
525a4c2612
2 changed files with 21 additions and 27 deletions
  1. 0 22
      .overcommit.sh
  2. 21 5
      .overcommit.yml

+ 0 - 22
.overcommit.sh

@@ -1,22 +0,0 @@
-#!/bin/bash
-
-set -eu
-
-# Don't require redis.
-export ZAMMAD_SAFE_MODE=1
-
-echo "Checking .pot catalog consistency…"
-rails generate zammad:translation_catalog --check &
-
-echo "Checking consistency of Settings types file…"
-rails generate zammad:setting_types --check &
-
-.gitlab/check_graphql_api_consistency.sh &
-
-FAILED=0
-for job in $(jobs -p)
-do
-  wait "$job" || (( FAILED+=1 ))
-done
-
-exit $FAILED

+ 21 - 5
.overcommit.yml

@@ -27,15 +27,31 @@ PreCommit:
     enabled: true
     on_warn: fail
     exclude: 'public/assets/chat/**/*'
-  CustomScript:
-    enabled: true
-    description: 'Perform custom Zammad code checks'
-    required_executable: 'bash'
-    flags: ['.overcommit.sh']
   Stylelint:
     enabled: true
     required_executable: 'yarn'
     command: ['yarn', '--silent', 'lint:css']
+  TranslationCatalogCheck:
+    required_executable: 'rails'
+    enabled: true
+    env:
+      ZAMMAD_SAFE_MODE: '1'
+    command: ['rails', 'generate', 'zammad:translation_catalog', '--check']
+  SettingsTypesCheck:
+    required_executable: 'rails'
+    enabled: true
+    env:
+      ZAMMAD_SAFE_MODE: '1'
+    command: ['rails', 'generate', 'zammad:setting_types', '--check']
+    include:
+      - 'db/seeds/settings.rb'
+  GraphQLAPICheck:
+    required_executable: '.gitlab/check_graphql_api_consistency.sh'
+    enabled: true
+    command: ['.gitlab/check_graphql_api_consistency.sh']
+    include:
+      - 'app/graphql/**/*'
+      - 'app/frontend/**/*.graphql'
   TypeCheck:
     required_executable: 'yarn'
     enabled: true