diff mbox series

[1/3] docs: rSTify the "SpellCheck" wiki

Message ID 20210922121054.1458051-2-kchamart@redhat.com (mailing list archive)
State New, archived
Headers show
Series rSTify SubmitAPatch, TrivialPatches, and SpellCheck wiki pages | expand

Commit Message

Kashyap Chamarthy Sept. 22, 2021, 12:10 p.m. UTC
The original wiki is here[1].  I converted by copying the wiki source[2]
into a .wiki file and convert to rST using `pandoc`:

    $ pandoc -f Mediawiki -t rst spell-check.wiki -o spell-check.rst

[1] https://wiki.qemu.org/Contribute/SpellCheck
[2] https://web.archive.org/web/20170721031029/http://wiki.qemu.org/index.php?title=Contribute/SubmitAPatch&action=edit

Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
---
 docs/devel/spell-check.rst | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
 create mode 100644 docs/devel/spell-check.rst

Comments

Peter Maydell Sept. 22, 2021, 1:10 p.m. UTC | #1
On Wed, 22 Sept 2021 at 13:11, Kashyap Chamarthy <kchamart@redhat.com> wrote:
>
> The original wiki is here[1].  I converted by copying the wiki source[2]
> into a .wiki file and convert to rST using `pandoc`:
>
>     $ pandoc -f Mediawiki -t rst spell-check.wiki -o spell-check.rst
>
> [1] https://wiki.qemu.org/Contribute/SpellCheck
> [2] https://web.archive.org/web/20170721031029/http://wiki.qemu.org/index.php?title=Contribute/SubmitAPatch&action=edit
>
> Signed-off-by: Kashyap Chamarthy <kchamart@redhat.com>
> ---
>  docs/devel/spell-check.rst | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
>  create mode 100644 docs/devel/spell-check.rst
>
> diff --git a/docs/devel/spell-check.rst b/docs/devel/spell-check.rst
> new file mode 100644
> index 0000000000..998cd7ef51
> --- /dev/null
> +++ b/docs/devel/spell-check.rst
> @@ -0,0 +1,29 @@
> +===========
> +Spell Check
> +===========
> +
> +QEMU uses British or American English in code and documentation. There
> +are some typical spelling bugs which can be easily avoided by using
> +tools like codespell.
> +
> +codespell is a python script which detects (and optionally fixes) the
> +most common spelling bugs.
> +
> +If you installed codespell in your HOME directory, it can be called from
> +the QEMU source directory like this::
> +
> +    ~/bin/codespell.py -d -r -s -x scripts/codespell.exclude -q 2 ~/share/codespell/dictionary.txt
> +
> +``-x scripts/codespell.exclude`` excludes some known lines from the check
> +and needs a file which is not yet committed.

This command doesn't actually work, because there is no
scripts/codespell.exclude in the source tree. It also
assumes you have a ~/share/codespell/dictionary.txt in your
home directory.

I think Stefan proposed a patch adding the excludelist file to
the source repository back when he wrote this wiki page a decade
ago, but it did not get through code review.

thanks
-- PMM
Kashyap Chamarthy Sept. 22, 2021, 1:48 p.m. UTC | #2
On Wed, Sep 22, 2021 at 02:10:43PM +0100, Peter Maydell wrote:
> On Wed, 22 Sept 2021 at 13:11, Kashyap Chamarthy <kchamart@redhat.com> wrote:

[...]

> > +If you installed codespell in your HOME directory, it can be called from
> > +the QEMU source directory like this::
> > +
> > +    ~/bin/codespell.py -d -r -s -x scripts/codespell.exclude -q 2 ~/share/codespell/dictionary.txt
> > +
> > +``-x scripts/codespell.exclude`` excludes some known lines from the check
> > +and needs a file which is not yet committed.
> 
> This command doesn't actually work, because there is no
> scripts/codespell.exclude in the source tree. It also
> assumes you have a ~/share/codespell/dictionary.txt in your
> home directory.
> 
> I think Stefan proposed a patch adding the excludelist file to
> the source repository back when he wrote this wiki page a decade
> ago, but it did not get through code review.

Thanks for catching it.  I couldn't find the unmerged
'codespell.exclude' from my searches online.  I don't know if it still
makes sense to include such a file.  But regardless, 'codespell' is
useful on its own.  

In v2, I can nuke that command altogether, and link to the README of
upstream 'codespell':

    https://github.com/codespell-project/codespell

I'll also edit the paragraph that talks about installing the the tool in
$HOME directory -- it's no longer required; many major distros packaged
it.  At least Debian, Ubuntu, and Fedora do (as 'codespell'), and the
dictionary file gets installed under:

    $> rpm -ql codespell | grep dictionary
    /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary.txt
    /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary_code.txt
    /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary_en-GB_to_en-US.txt
    /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary_informal.txt
    /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary_names.txt
    /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary_rare.txt
    /usr/lib/python3.9/site-packages/codespell_lib/data/dictionary_usage.txt

I'll also link to 'my-spell' from Alex Bennée, for Emacs users: 
https://github.com/stsquad/my-emacs-stuff/blob/master/my-spell.el
diff mbox series

Patch

diff --git a/docs/devel/spell-check.rst b/docs/devel/spell-check.rst
new file mode 100644
index 0000000000..998cd7ef51
--- /dev/null
+++ b/docs/devel/spell-check.rst
@@ -0,0 +1,29 @@ 
+===========
+Spell Check
+===========
+
+QEMU uses British or American English in code and documentation. There
+are some typical spelling bugs which can be easily avoided by using
+tools like codespell.
+
+codespell is a python script which detects (and optionally fixes) the
+most common spelling bugs.
+
+If you installed codespell in your HOME directory, it can be called from
+the QEMU source directory like this::
+
+    ~/bin/codespell.py -d -r -s -x scripts/codespell.exclude -q 2 ~/share/codespell/dictionary.txt
+
+``-x scripts/codespell.exclude`` excludes some known lines from the check
+and needs a file which is not yet committed.
+
+.. _external_links:
+
+External Links
+--------------
+
+-  http://packages.profusion.mobi/codespell/ (download)
+-  http://git.profusion.mobi/cgit.cgi/lucas/codespell/ (git repository)
+-  https://github.com/lucasdemarchi/codespell (alternate git repository)
+-  http://en.wikipedia.org/wiki/Wikipedia:Lists_of_common_misspellings/For_machines
+-  http://grammar.yourdictionary.com/spelling-and-word-lists/misspelled.html