-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclean.bash
More file actions
executable file
·25 lines (20 loc) · 924 Bytes
/
Copy pathclean.bash
File metadata and controls
executable file
·25 lines (20 loc) · 924 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
CLEAN_FILES=$(jq -r '.[]' .rubocop/clean_files.json)
if [[ -n "$CLEAN_FILES" ]]; then
echo "Removing clean files from .rubocop/exclusions.yml..."
# Escape special characters in filenames for awk regex
FILES_PATTERN=$(echo "$CLEAN_FILES" | sed 's/[.[\*^$]/\\&/g' | tr '\n' '|')
FILES_PATTERN="${FILES_PATTERN%|}" # Remove trailing pipe '|'
# Use awk to process exclusions.yml safely
awk -v pat="$FILES_PATTERN" '
/Exclude:/ {inside_exclude=1}
/^\s*$/ {inside_exclude=0}
inside_exclude && $0 ~ pat {next}
{print}
' .rubocop/exclusions.yml > .rubocop/exclusions.yml.tmp
mv .rubocop/exclusions.yml.tmp .rubocop/exclusions.yml
git config --global user.name "${{ github.actor }}"
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
git add .rubocop/exclusions.yml
git commit -m "ci: Removing fully lintable files from exclusion list [skip ci]"
git push
fi