From aec46942a85f060bf8dc85a4197e5b7baae38804 Mon Sep 17 00:00:00 2001 From: Jesse Duffield Date: Sat, 29 Apr 2023 12:58:28 +1000 Subject: [PATCH] enforce lowercase filenames --- .github/workflows/ci.yml | 2 ++ .../components/{viewDriver.go => view_driver.go} | 0 pkg/utils/{rebaseTodo.go => rebase_todo.go} | 0 .../{rebaseTodo_test.go => rebase_todo_test.go} | 0 scripts/check_filenames.sh | 14 ++++++++++++++ 5 files changed, 16 insertions(+) rename pkg/integration/components/{viewDriver.go => view_driver.go} (100%) rename pkg/utils/{rebaseTodo.go => rebase_todo.go} (100%) rename pkg/utils/{rebaseTodo_test.go => rebase_todo_test.go} (100%) create mode 100755 scripts/check_filenames.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ffe02ead8..05a5a0f73 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -140,6 +140,8 @@ jobs: run: | go generate pkg/integration/tests/tests.go && git diff --exit-code || (echo "Integration test list not up to date. Run 'go generate pkg/integration/tests/tests.go' locally and commit the changes" && exit 1) shell: bash # needed so that we get "-o pipefail" + - name: Check Filenames + run: scripts/check_filenames.sh lint: runs-on: ubuntu-latest env: diff --git a/pkg/integration/components/viewDriver.go b/pkg/integration/components/view_driver.go similarity index 100% rename from pkg/integration/components/viewDriver.go rename to pkg/integration/components/view_driver.go diff --git a/pkg/utils/rebaseTodo.go b/pkg/utils/rebase_todo.go similarity index 100% rename from pkg/utils/rebaseTodo.go rename to pkg/utils/rebase_todo.go diff --git a/pkg/utils/rebaseTodo_test.go b/pkg/utils/rebase_todo_test.go similarity index 100% rename from pkg/utils/rebaseTodo_test.go rename to pkg/utils/rebase_todo_test.go diff --git a/scripts/check_filenames.sh b/scripts/check_filenames.sh new file mode 100755 index 000000000..a9b3c242d --- /dev/null +++ b/scripts/check_filenames.sh @@ -0,0 +1,14 @@ +#!/bin/bash + +# Find all Go files in the project directory and its subdirectories, except in the vendor directory +for file in $(find . -name "*.go" -not -path "./vendor/*"); do + + # Check if the file name contains uppercase letters + if [[ "$file" =~ [A-Z] ]]; then + echo "Error: $file contains uppercase letters. All Go files in the project (excluding vendor directory) must use snake_case" + exit 1 + fi +done + +echo "All Go files in the project (excluding vendor directory) use lowercase letters" +exit 0