Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: Codespell report for "zsh" (on fossies.org)



Hi Daniel,

Fossies Administrator wrote on Thu, Jan 09, 2020 at 13:05:13 +0100:
the FOSS server fossies.org - also supporting "zsh" - offers a new feature
"Source code misspelling reports":

 https://fossies.org/features.html#codespell

Such reports are normally only generated on request, but as Fossies
administrator I have just created (for testing purposes) an analysis for the
current "zsh" release 5.7.1:

 https://fossies.org/linux/misc/zsh/codespell.html
Maybe more meaningful is an additional report for the current Git master
version that can be found in a special "test" folder (that isn't integrated
in the Fossies standard services and should - at least principally - not
accessible by search engines):

 https://fossies.org/linux/test/zsh-code-4858e868dcf809016a1cb5680327d66d551353ae.zip/codespell.html

Obviously in that current development version some of the spelling errors
respectively typos are already fixed.

Thanks a lot.  I've committed it, minus the archived changelog files (I left
them as-is for ease of correlation to git logs), false positives, and variant
spellings.

Is it possible to get the report in the form of a unidiff?

The request is understandable and I thought about such a Fossies service but since I'm not sure which of the matched words are really spelling errors or typos that could respectively should be corrected Fossies offers only the information (especially variable and class names, mail addresses and words that directly "touch" some kinds of delimiters or escape characters may be problematic, some spelling corrections may be ambiguous, some words can be deliberately misspelled and some corrections may have unwanted side effects).

So a vague idea was to make the spelling errors selectable and then to create multiple (or even one) unidiff files but that isn't trivial to realize and for e.g. probably not usable by projects using GitHub.

By the way, the basically used tool "codespell" (https://github.com/codespell-project/codespell) offers an option "--write-changes" to "write changes in place if possible".

Basically the first thing I did with the report is to convert it to a wdiff, with the following script:

[[[
#!/usr/bin/env zsh

setopt extendedglob

< fossies.out while IFS=$'\t\n' read -r ignore from to fname_and_parenthesized_lineno; do
 fname=${fname_and_parenthesized_lineno%% *}
 parenthesized_lineno=${fname_and_parenthesized_lineno#* }
 if printf %s $from $to | grep -E -q '^[A-Za-z0-9_]+$'; then
   perl -pi -E "s/\\b\\Q$from\\E\\b/$to/ if \$. == $parenthesized_lineno" -- ${fname#*/}
 else
   echo >&2 "$0: warning: skipped [$from $to $fname $parenthesized_lineno]"
 fi
done
]]]

… where fossies.out was created by copy-pasting the table from firefox into a text file.

Interesting.

Wow, since I saw that already many corrections are done (Mikael?) I created just a new report (excluding all the files */Etc/ChangeLog-*):

 https://fossies.org/linux/test/zsh-code-742ab1283bf383932ff2daec1f93731ddfb31282.zip/codespell.html

Looks much better!

Regards

Jens

--
FOSSIES - The Fresh Open Source Software archive
mainly for Internet, Engineering and Science
https://fossies.org/


Messages sorted by: Reverse Date, Date, Thread, Author