Holistic local linting with Mega-Linter

This commit is contained in:
Matt Bishop
2025-06-07 10:33:24 -04:00
parent 25d5efacd8
commit fe24bc79ce
3 changed files with 29 additions and 24 deletions

View File

@@ -1,8 +1,14 @@
#!/bin/bash
#!/bin/sh
FILES=$(git diff --cached --name-only --diff-filter=ACM "*.cs")
if [ -n "$FILES" ]
then
dotnet format ./bitwarden-server.sln --no-restore --include $FILES
echo "$FILES" | xargs git add
FILES=$(git diff --cached --name-only --diff-filter=ACMR | sed 's| |\\ |g')
[ -z "$FILES" ] && exit 0
if npx mega-linter-runner --containername "megalinter-incremental" \
--flavor formatters --remove-container --fix --env "'APPLY_FIXES=all'" \
--env "'CLEAR_REPORT_FOLDER=true'" --env "'LOG_LEVEL=warning'" \
--filesonly $FILES; then
echo "$FILES" | xargs git add
exit 0
fi
exit 1