[dpdk-dev] [PATCH] doc/guides: clean repeated words

David Marchand david.marchand at redhat.com
Wed Nov 13 10:12:23 CET 2019



On 12/11/2019 20:33, David Marchand wrote:
> Shoot repeated words in all our guides.
> 
> Signed-off-by: David Marchand <david.marchand at redhat.com>

For anyone interested, I caught this with a patch I added to my checks:

awk '
{
	if (prev_file != FILENAME) {
		prev=""
		prev_line=""
		prev_file=FILENAME
		NR=1
		display_banner=1
	}
	for (i = 1; i <= NF; i++) {
		current=tolower($i)
		if (current ~ /^[a-z]*$/ && prev == current) {
			if (display_banner == 1) {
				print "\n"FILENAME":"
				display_banner=0
			}
			print "  Detected repeated word \""prev"\""
			if (i == 1) {
				printf("    %5d: \"%s\"\n", NR-1, prev_line)
			}
			printf("    %5d: \"%s\"\n", NR, $0)
		}
		prev=current
	}
	prev_line=$0
	if (NF == 0) {
		prev=""
	}
}' $(git ls-tree --name-only -r HEAD |grep -E '\.rst$') >.check/doc.txt


It has some false positive, so the output is compared to a reference
output I manually checked once.

if [ -e .check/doc.ref ] ; then
	diff -u0 .check/doc.ref .check/doc.txt
else
	mv .check/doc.txt .check/doc.ref
fi


-- 
David Marchand



More information about the dev mailing list