-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomprehensive_duplicate_check.sh
More file actions
executable file
·43 lines (36 loc) · 1.33 KB
/
comprehensive_duplicate_check.sh
File metadata and controls
executable file
·43 lines (36 loc) · 1.33 KB
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
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/bin/bash
echo "=== COMPREHENSIVE DUPLICATE METHOD CHECK ==="
echo ""
check_file() {
local file=$1
echo "Checking: $file"
echo "------------------------"
if [ ! -f "$file" ]; then
echo "File not found: $file"
return
fi
# Extract method names with line numbers
grep -n "^\s*\(public\|private\|protected\)\s\+function\s\+" "$file" | while read line; do
line_number=$(echo "$line" | cut -d: -f1)
method_line=$(echo "$line" | cut -d: -f2-)
method_name=$(echo "$method_line" | sed 's/.*function \s*\([a-zA-Z_][a-zA-Z0-9_]*\).*/\1/')
echo " Line $line_number: $method_name"
done
echo ""
echo "Method frequency count for $file:"
grep -o "function\s\+[a-zA-Z_][a-zA-Z0-9_]*" "$file" | sed 's/function\s\+//' | sort | uniq -c | sort -nr
echo ""
echo "DUPLICATES in $file (if any):"
duplicates=$(grep -o "function\s\+[a-zA-Z_][a-zA-Z0-9_]*" "$file" | sed 's/function\s\+//' | sort | uniq -c | sort -nr | awk '$1 > 1')
if [ -n "$duplicates" ]; then
echo "$duplicates"
else
echo "No duplicates found"
fi
echo ""
echo "=============================================="
echo ""
}
# Check both files
check_file "app/Services/InstructionRequestService.php"
check_file "app/Http/Controllers/InstructionRequestController.php"