@@ -7,8 +7,8 @@ echo "------------------------------------------------------"
77
88# Function to clean up on exit
99cleanup () {
10- echo " Cleaning up..."
11- rm -rf" $TEMP_DIR "
10+ echo " Cleaning up..."
11+ rm -rf" $TEMP_DIR "
1212}
1313
1414# Create temporary directory
@@ -30,7 +30,7 @@ cp -r ".github/docs/config/.markdownlint.yml" "$CONFIG_DIR/"
3030cp -r" .github/docs/vale" " $TEMP_DIR /.github/docs/"
3131
3232# Create a sample markdown file with issues
33- cat> " $DOCS_DIR /sample.md" << EOF
33+ cat> " $DOCS_DIR /sample.md" << EOF
3434# Sample Document for Testing
3535
3636This is a simple document for testing MegaLinter integration.
@@ -53,38 +53,38 @@ Here's a reference to a [non-existent document](nonexistent.md).
5353EOF
5454
5555# 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"
5757
5858echo " === PHASE 1: Testing markdownlint ==="
5959echo " -----------------------------------------"
6060
61- if command -v markdownlint-cli2& > /dev/null; then
62- echo " Testing markdownlint-cli2 on sample document..."
63- pnpmexec 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+ pnpmexec markdownlint-cli2" $DOCS_DIR /sample.md" || echo " ✅ Found markdown issues as expected"
6464else
65- echo " ⚠️ markdownlint-cli2 not available, skipping test"
65+ echo " ⚠️ markdownlint-cli2 not available, skipping test"
6666fi
6767
6868echo
6969echo " === PHASE 2: Testing Vale ==="
7070echo " -----------------------------"
7171
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"
7575else
76- echo " ⚠️ Vale not available, skipping test"
76+ echo " ⚠️ Vale not available, skipping test"
7777fi
7878
7979echo
8080echo " === PHASE 3: Testing markdown-link-check ==="
8181echo " --------------------------------------------"
8282
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"
8686else
87- echo " ⚠️ markdown-link-check not available, skipping test"
87+ echo " ⚠️ markdown-link-check not available, skipping test"
8888fi
8989
9090echo
@@ -93,23 +93,23 @@ echo "--------------------------------------------------"
9393
9494# Create a function to simulate the cross-reference validation logic
9595check_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
113113}
114114
115115# Run cross-reference check
@@ -125,4 +125,4 @@ echo "2. Vale style checking"
125125echo " 3. Link validation"
126126echo " 4. Cross-reference checking"
127127echo
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"