@@ -7,8 +7,8 @@ echo "------------------------------------------------------"
7
7
8
8
# Function to clean up on exit
9
9
cleanup () {
10
- echo " Cleaning up..."
11
- rm -rf " $TEMP_DIR "
10
+ echo " Cleaning up..."
11
+ rm -rf " $TEMP_DIR "
12
12
}
13
13
14
14
# Create temporary directory
@@ -30,7 +30,7 @@ cp -r ".github/docs/config/.markdownlint.yml" "$CONFIG_DIR/"
30
30
cp -r " .github/docs/vale" " $TEMP_DIR /.github/docs/"
31
31
32
32
# Create a sample markdown file with issues
33
- cat > " $DOCS_DIR /sample.md" << EOF
33
+ cat > " $DOCS_DIR /sample.md" << EOF
34
34
# Sample Document for Testing
35
35
36
36
This is a simple document for testing MegaLinter integration.
@@ -53,38 +53,38 @@ Here's a reference to a [non-existent document](nonexistent.md).
53
53
EOF
54
54
55
55
# Create mock changed files list
56
- echo ' ["docs/sample.md"]' > " $TEMP_DIR /changed_files.json"
56
+ echo ' ["docs/sample.md"]' > " $TEMP_DIR /changed_files.json"
57
57
58
58
echo " === PHASE 1: Testing markdownlint ==="
59
59
echo " -----------------------------------------"
60
60
61
- if command -v markdownlint-cli2 & > /dev/null; then
62
- echo " Testing markdownlint-cli2 on sample document..."
63
- pnpm exec markdownlint-cli2 " $DOCS_DIR /sample.md" || echo " ✅ Found markdown issues as expected"
61
+ if command -v markdownlint-cli2 & > /dev/null; then
62
+ echo " Testing markdownlint-cli2 on sample document..."
63
+ pnpm exec markdownlint-cli2 " $DOCS_DIR /sample.md" || echo " ✅ Found markdown issues as expected"
64
64
else
65
- echo " ⚠️ markdownlint-cli2 not available, skipping test"
65
+ echo " ⚠️ markdownlint-cli2 not available, skipping test"
66
66
fi
67
67
68
68
echo
69
69
echo " === PHASE 2: Testing Vale ==="
70
70
echo " -----------------------------"
71
71
72
- if command -v vale & > /dev/null; then
73
- echo " Testing Vale on sample document..."
74
- vale --output=line --config=" .github/docs/vale/.vale.ini" " $DOCS_DIR /sample.md" || echo " ✅ Found style issues as expected"
72
+ if command -v vale & > /dev/null; then
73
+ echo " Testing Vale on sample document..."
74
+ vale --output=line --config=" .github/docs/vale/.vale.ini" " $DOCS_DIR /sample.md" || echo " ✅ Found style issues as expected"
75
75
else
76
- echo " ⚠️ Vale not available, skipping test"
76
+ echo " ⚠️ Vale not available, skipping test"
77
77
fi
78
78
79
79
echo
80
80
echo " === PHASE 3: Testing markdown-link-check ==="
81
81
echo " --------------------------------------------"
82
82
83
- if command -v markdown-link-check & > /dev/null; then
84
- echo " Testing markdown-link-check on sample document..."
85
- markdown-link-check " $DOCS_DIR /sample.md" || echo " ✅ Found link issues as expected"
83
+ if command -v markdown-link-check & > /dev/null; then
84
+ echo " Testing markdown-link-check on sample document..."
85
+ markdown-link-check " $DOCS_DIR /sample.md" || echo " ✅ Found link issues as expected"
86
86
else
87
- echo " ⚠️ markdown-link-check not available, skipping test"
87
+ echo " ⚠️ markdown-link-check not available, skipping test"
88
88
fi
89
89
90
90
echo
@@ -93,23 +93,23 @@ echo "--------------------------------------------------"
93
93
94
94
# Create a function to simulate the cross-reference validation logic
95
95
check_cross_references () {
96
- local docs_dir=" $1 "
97
-
98
- echo " Checking cross-references in $docs_dir ..."
99
-
100
- # Check for broken internal links
101
- for file in " $docs_dir " /* .md; do
102
- echo " Checking $file for broken references..."
103
- # Extract markdown links that aren't http/https
104
- if grep -q -E ' \[[^]]+\]\(nonexistent.md\)' " $file " ; then
105
- echo " Found broken reference to nonexistent.md in $file "
106
- echo " ✅ Found cross-reference issues as expected"
107
- return 0
108
- fi
109
- done
110
-
111
- echo " ❌ No cross-reference issues found when issues were expected"
112
- return 1
96
+ local docs_dir=" $1 "
97
+
98
+ echo " Checking cross-references in $docs_dir ..."
99
+
100
+ # Check for broken internal links
101
+ for file in " $docs_dir " /* .md; do
102
+ echo " Checking $file for broken references..."
103
+ # Extract markdown links that aren't http/https
104
+ if grep -q -E ' \[[^]]+\]\(nonexistent.md\)' " $file " ; then
105
+ echo " Found broken reference to nonexistent.md in $file "
106
+ echo " ✅ Found cross-reference issues as expected"
107
+ return 0
108
+ fi
109
+ done
110
+
111
+ echo " ❌ No cross-reference issues found when issues were expected"
112
+ return 1
113
113
}
114
114
115
115
# Run cross-reference check
@@ -125,4 +125,4 @@ echo "2. Vale style checking"
125
125
echo " 3. Link validation"
126
126
echo " 4. Cross-reference checking"
127
127
echo
128
- echo " The workflow is properly configured to use standardized tools through MegaLinter's documentation flavor"
128
+ echo " The workflow is properly configured to use standardized tools through MegaLinter's documentation flavor"
0 commit comments