[draft] Invariant testing #971
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Enforce kebab-case | |
on: [push, pull_request] | |
jobs: | |
check-filenames: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Check For Non Kebab-Cased File Names | |
run: | | |
non_compliant_files=() | |
while read -r file; do | |
basefile=$(basename "$file") | |
if echo "$file" | grep -q -E "^\.\/\..*\/|^\.\/[^\/]*$|^\.\/node_modules|^\.\/\.git|^\.\/dist|^\.\/build|^\.\/vendor|^\.\/\.next|\.sql$|\.md$|LICENSE|echidna\.config\.yml|\.env\.example|slither\.config\.json|\.solhint\.json|\.npmrc|global\.d\.ts|_app\.tsx|next-env\.d\.ts|next\.config\.js|docs|\.sol$"; then | |
continue | |
elif ! echo "$basefile" | grep -q -E "^([a-z0-9]+-)*[a-z0-9]+(\.[a-zA-Z0-9]+)?$|^([a-z0-9]+_)*[a-z0-9]+(\.[a-zA-Z0-9]+)?$"; then | |
non_compliant_files+=("$file") | |
echo "::warning file=$file::This file is not in kebab-case or snake_case" | |
fi | |
done < <(find . -type f) | |
if [ ${#non_compliant_files[@]} -ne 0 ]; then | |
echo "The following files are not in kebab-case or snake_case:" | |
for file in "${non_compliant_files[@]}"; do | |
echo " - $file" | |
done | |
exit 1 | |
fi |