mirror of
https://github.com/pion/webrtc.git
synced 2025-12-24 11:51:03 +08:00
Add lint for filenames
We have established a pattern of Alpha and underscores for filenames. This adds a hook to keep this pattern going. Also fixes a misnamed file I found in the process. Resolves #456
This commit is contained in:
14
.github/lint-filename.sh
vendored
Executable file
14
.github/lint-filename.sh
vendored
Executable file
@@ -0,0 +1,14 @@
|
||||
#!/usr/bin/env bash
|
||||
set -e
|
||||
|
||||
SCRIPT_PATH=$( cd "$(dirname "${BASH_SOURCE[0]}")" ; pwd -P )
|
||||
GO_REGEX="^[a-zA-Z_]+\.go$"
|
||||
|
||||
find "$SCRIPT_PATH/.." -name "*.go" | while read fullpath; do
|
||||
filename=$(basename -- "$fullpath")
|
||||
|
||||
if ! [[ $filename =~ $GO_REGEX ]]; then
|
||||
echo "$filename is not a valid filename for Go code, only alpha and underscores are supported"
|
||||
exit 1
|
||||
fi
|
||||
done
|
||||
@@ -26,3 +26,4 @@ script:
|
||||
- bash .github/assert-contributors.sh
|
||||
- bash .github/lint-disallowed-functions-in-library.sh
|
||||
- bash .github/lint-commit-message.sh
|
||||
- bash .github/lint-filename.sh
|
||||
|
||||
Reference in New Issue
Block a user