-
-
Notifications
You must be signed in to change notification settings - Fork 609
Expand file tree
/
Copy pathfix.sh
More file actions
117 lines (93 loc) · 3.46 KB
/
fix.sh
File metadata and controls
117 lines (93 loc) · 3.46 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
#!/bin/bash
# Complete fix for ajeetraina/kubetools codespell issues (macOS/Linux compatible)
echo "🔧 Fixing CodeSpell issues in ajeetraina/kubetools repository"
# Check if we're on macOS or Linux for sed compatibility
if [[ "$OSTYPE" == "darwin"* ]]; then
# macOS
SED_INPLACE="sed -i ''"
else
# Linux
SED_INPLACE="sed -i"
fi
# Step 1: Fix the main spelling errors in README.md
echo "📝 Fixing spelling errors in README.md..."
# Fix "Developement" -> "Development" (this is the main one causing build failure)
$SED_INPLACE 's/Developement Tools\/Kit/Development Tools\/Kit/g' README.md
$SED_INPLACE 's/Developement/Development/g' README.md
# Fix other potential issues based on the logs
$SED_INPLACE 's/kubernentes/kubernetes/g' README.md
$SED_INPLACE 's/Kubernets/Kubernetes/g' README.md
$SED_INPLACE 's/bandwith/bandwidth/g' README.md
$SED_INPLACE 's/objets/objects/g' README.md
$SED_INPLACE 's/foor/for/g' README.md
$SED_INPLACE 's/Funktion/Function/g' README.md
$SED_INPLACE 's/funktion/function/g' README.md
echo "✅ Fixed spelling errors in README.md"
# Step 2: Create .codespellrc to handle false positives
echo "⚙️ Creating .codespellrc configuration..."
cat > .codespellrc << 'EOF'
[codespell]
# Ignore legitimate terms that codespell flags incorrectly
ignore-words-list = rouge
# Skip files that commonly have false positives
skip = ./.git,./Gemfile.lock,./vendor,./node_modules,*.png,*.jpg,*.jpeg,*.pdf,*.svg,*.ico
# Check filenames too
check-filenames = true
# Don't check hidden files
check-hidden = false
EOF
echo "✅ Created .codespellrc configuration"
# Step 3: Update the GitHub Actions workflow for better configuration
echo "🔄 Updating GitHub Actions workflow..."
mkdir -p .github/workflows
cat > .github/workflows/codespell.yml << 'EOF'
name: CodeSpell Integration
on:
# Runs on pushes targeting the default branch
push:
branches: ["master"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Codespell
uses: codespell-project/actions-codespell@v2
with:
# Skip files that commonly have false positives
skip: "Gemfile.lock,vendor"
# Ignore words that are legitimate but flagged as errors
ignore_words_list: "rouge"
# Check filenames too
check_filenames: true
check_hidden: false
EOF
echo "✅ Updated GitHub Actions workflow"
# Step 4: Show what was changed
echo "📋 Summary of changes made:"
echo " - Fixed 'Developement' -> 'Development' in README.md"
echo " - Fixed other spelling errors"
echo " - Created .codespellrc configuration"
echo " - Updated GitHub Actions workflow"
# Step 5: Test the fixes locally (if codespell is installed)
echo "🧪 Testing fixes..."
if command -v codespell &> /dev/null; then
echo "Running codespell to verify fixes..."
if codespell --config .codespellrc; then
echo "✅ All spelling errors fixed!"
else
echo "⚠️ Some issues may remain - check output above"
fi
else
echo "ℹ️ Install codespell to verify: pip install codespell"
fi
echo ""
echo "🎯 Next steps:"
echo "1. Review the changes: git diff"
echo "2. Commit the changes: git add . && git commit -m 'Fix spelling errors and configure codespell'"
echo "3. Push to trigger build: git push"
echo ""
echo "🚀 Your build should now pass!"