Skip to content

Commit

Permalink
Add adding ignore-regex for ipynb to ignore images
Browse files Browse the repository at this point in the history
Well -- there are more advanced regexes I had to craft, so we
might want to add them here later, but this one was most useful
so far
  • Loading branch information
yarikoptic committed Nov 3, 2023
1 parent 658fdc4 commit c849286
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions codespellit
Original file line number Diff line number Diff line change
Expand Up @@ -59,19 +59,24 @@ for d in venv .venv venvs .tox versioneer.py package-lock.json *.lock; do
fi
done

# TODO: for .ipynb add
# /home/yoh/proj/misc/NeuromatchAcademy-course-content/.codespellrc has even more advanced ones
# ignore-regex = '^\s*"image/\S+": ".*'
#
ignore_regex=''
if find . -iname '*.ipynb' -print -quit | grep -q .; then
ignore_regex='^\s*"image/\S+": ".*'
fi

ignore_regex_prefix=''
if [ -z "$ignore_regex" ]; then
ignore_regex_prefix="# "
fi

if [ -e pyproject.toml ]; then
config="pyproject.toml"
cat >> pyproject.toml <<EOF
[tool.codespell]
skip = '$skips'
check-hidden = True
#
# ignore-regex = ''
${ignore_regex_prefix}ignore-regex = '$ignore_regex'
# ignore-words-list = ''
EOF
else
Expand All @@ -82,7 +87,7 @@ else
[codespell]
skip = $skips
check-hidden = true
# ignore-regex =
${ignore_regex_prefix}ignore-regex = $ignore_regex
# ignore-words-list =
EOF
fi
Expand Down

0 comments on commit c849286

Please sign in to comment.