Skip to content

Commit c9cb16a

Browse files
authored
Fix error when unindent_auto_doc_script is not found (#96)
As previously coded, this emits the delightfully cryptic error message ``` File "/home/runner/work/stout/stout/./dev-tools/README.md", line 3 Collection of developer scripts, files, etc, for improving the developer process. ^^ SyntaxError: invalid syntax ``` Because the failure to find the unindent script results in trying to run `python README.md`
1 parent 10792b9 commit c9cb16a

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

check-style.sh

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,9 +143,14 @@ if [ ! -z "${affected_files}" ]; then
143143
# Check documentation snippets (which can be affected by changes in any other file).
144144
# Markdown files exclude `node_modules` (pulled NPM packages) and `site-packages` (pulled Python packages).
145145
markdown_files=$(find . -type f \( -name "*.md" -o -name "*.mdx" \) -not \( -path "*/node_modules/*" -o -path "*/site-packages/*" \))
146-
unindent_auto_doc_script=$(find . -type f -name 'unindent_auto_doc.py')
147146
pre_autodocs_checksum=$(calculate_checksum $markdown_files)
148-
run_check markdown-autodocs -c code-block -o ${markdown_files} > /dev/null && python $unindent_auto_doc_script ${markdown_files} > /dev/null
147+
148+
run_check markdown-autodocs -c code-block -o ${markdown_files} > /dev/null
149+
unindent_auto_doc_script=$(find . -type f -name 'unindent_auto_doc.py')
150+
if [[ -n "$unindent_auto_doc_script" ]]; then
151+
python "$unindent_auto_doc_script" ${markdown_files} > /dev/null
152+
fi
153+
149154
post_autodocs_checksum=$(calculate_checksum $markdown_files)
150155
if [ "$pre_autodocs_checksum" != "$post_autodocs_checksum" ]; then
151156
echo "There are code changes after running 'markdown-autodocs'."

0 commit comments

Comments
 (0)