File: spellcheck_code_comments.sh

package info (click to toggle)
unknown-horizons 2019.1-8
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 347,924 kB
  • sloc: python: 46,805; xml: 3,137; sql: 1,189; sh: 736; makefile: 39; perl: 35
file content (29 lines) | stat: -rwxr-xr-x 644 bytes parent folder | download | duplicates (7)
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
#!/bin/sh

#
# Runs aspell on every single line comment of every .py file in the current dir and subdirs
# (requires aspell, naturally)
#

echo $#
if [ $# -eq 1 ]; then
	echo "Checking $1 .."
	aspell -l en check "$1"
	exit 0
	TMPFILE=`mktemp`
	tail -n +21 "$1" | grep '#' | cut -d '#' -f 2 > "$TMPFILE"
	TMPFILE2=`mktemp`
	cp "$TMPFILE" "$TMPFILE2"
	aspell -l en check "$TMPFILE"
	if ! diff "$TMPFILE" "$TMPFILE2" ; then
		echo "you changed the stuff above something, please propagate to the source file: $1"
		echo "Then press enter"
		read
	fi
	rm "$TMPFILE" "$TMPFILE2"
	exit $?
fi

find . -type f -iname \*.py  -exec $0 {} \;

echo "Done."