summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKyren223 <Kyren223@proton.me>2025-07-20 16:36:21 +0300
committerKyren223 <Kyren223@proton.me>2025-07-20 16:36:21 +0300
commit3f0128d71bcffcc99139bbb6c4ea27573343fe18 (patch)
tree393f32b2a5b9f24e86546b2c2f172489165771f9
parent57dc684b8935a0e1eeaba445e84a69c523a03ff1 (diff)
Updated copyright script to allow exclusions of codegen and tools
-rwxr-xr-xcopyright.sh19
-rw-r--r--tools/test_rate_limit.go16
2 files changed, 18 insertions, 17 deletions
diff --git a/copyright.sh b/copyright.sh
index 2d8ab38..cc3a612 100755
--- a/copyright.sh
+++ b/copyright.sh
@@ -18,6 +18,9 @@ HEADER="// Eko: A terminal based social media platform
// You should have received a copy of the GNU Affero General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>."
+# List of paths to exclude (files or directories)
+EXCLUDE_PATHS=("internal/data" "tools/test_rate_limit.go")
+
# Check if .go files exist recursively
if ! find . -type f -name "*.go" | grep -q .; then
echo "No .go files found in the current directory or subdirectories."
@@ -27,8 +30,22 @@ fi
# Get current year
CURRENT_YEAR=$(date +%Y)
-# Apply header to all .go files recursively
+# Apply header to all .go files recursively, excluding specified paths
find . -type f -name "*.go" | while IFS= read -r file; do
+ # Check if file or its parent directories are in EXCLUDE_PATHS
+ skip=false
+ for exclude in "${EXCLUDE_PATHS[@]}"; do
+ if [[ "$file" == "./$exclude" || "$file" == ./"$exclude"/* ]]; then
+ skip=true
+ break
+ fi
+ done
+
+ if [ "$skip" = true ]; then
+ echo "Skipped $file (in excluded path)"
+ continue
+ fi
+
# Skip if file already has Copyright in the first 10 lines
if ! head -n 10 "$file" | grep -q "Copyright"; then
# Prepend header with a single newline, preserving original content
diff --git a/tools/test_rate_limit.go b/tools/test_rate_limit.go
index 53b2ecb..7c25d20 100644
--- a/tools/test_rate_limit.go
+++ b/tools/test_rate_limit.go
@@ -1,19 +1,3 @@
-// Eko: A terminal based social media platform
-// Copyright (C) 2025 Kyren223
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU Affero General Public License as published
-// by the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU Affero General Public License for more details.
-//
-// You should have received a copy of the GNU Affero General Public License
-// along with this program. If not, see <https://www.gnu.org/licenses/>.
-
package main
import (