[PATCH v2] devtools: spell check
Stephen Hemminger
stephen at networkplumber.org
Fri Nov 12 20:23:50 CET 2021
On Fri, 12 Nov 2021 13:14:45 -0500
Henry Nadeau <hnadeau at iol.unh.edu> wrote:
> +# Compares diff between current branch and it's remote counterpart
> +if [ ! $all_check = 'true' ]; then
> + git diff "$branch" origin/"$remote_branch" --name-only |
> + grep ".*\.rst" |
> + # run the spellcheck function over each file in parallel, appending
> + # misspellings to the output file
> + parallel -j "$(nproc)" spellcheck_file {} "$allowed_words" "$dpdk_dir" \
> + "$regex_pattern" >> "$output"
> + else
> + cd "$dpdk_dir"
> + find . -name "*.rst" -type f | parallel -j "$(nproc)" spellcheck_file {} \
> + "$allowed_words" "$dpdk_dir" "$regex_pattern" >>"$output"
> +fi
> +
> +
> +cat "$output"
> +
> +# remove empty lines in the output
> +sed -i '/^$/d' "$output"
> +
> +# Errors can be counted by counting the number of lines in the output
> +errors="$(wc -l "$output" | cut -d ' ' -f 1)"
> +printf "Errors found: %d\n" "$errors" | tee -a "$output"
> +
> +# Make the exit code the number of errors
> +exit "$errors"
Seems like this is adding alot of git stuff to what could just be
a tool to report the spelling errors in the current branch.
More information about the dev
mailing list