fix: fixes for running checks on pre-commit for BE and FE separately (#25319)
## Description Fixes for running checks on pre-commit for BE and FE separately #### Type of change - Bug fix (non-breaking change which fixes an issue) ## Testing > #### How Has This Been Tested? > Please describe the tests that you ran to verify your changes. Also list any relevant details for your test configuration. > Delete anything that is not relevant - [x] Manual - [ ] Jest - [ ] Cypress ## Checklist: #### Dev activity - [x] My code follows the style guidelines of this project - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have made corresponding changes to the documentation - [x] My changes generate no new warnings - [ ] I have added tests that prove my fix is effective or that my feature works - [x] New and existing unit tests pass locally with my changes - [ ] PR is being merged under a feature flag Co-authored-by: Valera Melnikov <melnikov.vv@greendatasoft.ru>
This commit is contained in:
parent
0dcef48dc8
commit
2b59f40a0b
19
app/client/.husky/check-staged-files.sh
Normal file
19
app/client/.husky/check-staged-files.sh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
#!/bin/bash
|
||||
|
||||
is_server_change=$(git diff --cached --name-only | grep -c "app/server")
|
||||
is_client_change=$(git diff --cached --name-only | grep -c "app/client")
|
||||
|
||||
if [ "$is_server_change" -ge 1 ]; then
|
||||
echo "Running Spotless check ..."
|
||||
pushd app/server > /dev/null
|
||||
(mvn spotless:check 1> /dev/null && popd > /dev/null) || (echo "Spotless check failed, please run mvn spotless:apply" && exit 1)
|
||||
else
|
||||
echo "Skipping server side check..."
|
||||
fi
|
||||
|
||||
if [ "$is_client_change" -ge 1 ]; then
|
||||
echo "Running client check ..."
|
||||
npx lint-staged --cwd app/client && git-secrets --scan --untracked && git-secrets --scan -r
|
||||
else
|
||||
echo "Skipping client side check..."
|
||||
fi
|
||||
|
|
@ -1,8 +1,4 @@
|
|||
#!/usr/bin/env sh
|
||||
. "$(dirname -- "$0")/_/husky.sh"
|
||||
|
||||
npx lint-staged --cwd app/client && git-secrets --scan --untracked && git-secrets --scan -r
|
||||
|
||||
echo "Running Spotless check ..."
|
||||
pushd app/server > /dev/null
|
||||
(mvn spotless:check 1> /dev/null && popd > /dev/null) || (echo "Spotless check failed, please run mvn spotless:apply" && exit 1)
|
||||
sh app/client/.husky/check-staged-files.sh
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user