Skip to content

Commit

Permalink
Update README.rst
Browse files Browse the repository at this point in the history
Update the README to elaborate on case-sensitivity in ignored words
and dictionaries.

Add an additional "Ignoring Words" section, with internal link from the
"noteworthy flags" overview.

Co-authored-by: Peter Newman <[email protected]>
Co-authored-by: Dimitri Papadopoulos Orfanos <[email protected]>
  • Loading branch information
3 people committed Apr 28, 2023
1 parent 8f0e987 commit bb09cb3
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -55,25 +55,25 @@ Some noteworthy flags:
codespell -w, --write-changes
The ``-w`` flag will actually implement the changes recommended by codespell. Running without the ``-w`` flag is the same as with doing a dry run. It is recommended to run this with the ``-i`` or ``--interactive`` flag.
The ``-w`` flag will actually implement the changes recommended by codespell. Running without the ``-w`` flag is the same as doing a dry run. It is recommended to run this with the ``-i`` or ``--interactive`` flag.

.. code-block:: sh
codespell -I FILE, --ignore-words=FILE
The ``-I`` flag can be used for a list of certain words to allow that are in the codespell dictionaries. The format of the file is one word per line. Invoke using: ``codespell -I path/to/file.txt`` to execute codespell referencing said list of allowed words. **Important note:** The list passed to ``-I`` is case-sensitive based on how it is listed in the codespell dictionaries.
The ``-I`` flag can be used for a list of certain words to allow that are in the codespell dictionaries. The format of the file is one word per line. Invoke using: ``codespell -I path/to/file.txt`` to execute codespell referencing said list of allowed words. See `Ignoring Words`_ for more details.

.. code-block:: sh
codespell -L word1,word2,word3,word4
The ``-L`` flag can be used to allow certain words that are comma-separated placed immediately after it. **Important note:** The list passed to ``-L`` is case-sensitive based on how it is listed in the codespell dictionaries.
The ``-L`` flag can be used to allow certain words that are comma-separated placed immediately after it. See `Ignoring Words`_ for more details.

.. code-block:: sh
codespell -x FILE, --exclude-file=FILE
Ignore whole lines that match those in ``FILE``. The lines in ``FILE`` should match the to-be-excluded lines exactly.
Ignore whole lines that match those in ``FILE``. The lines in ``FILE`` should match the to-be-excluded lines exactly. ::

.. code-block:: sh
Expand Down Expand Up @@ -116,6 +116,25 @@ Want to know if a word you're proposing exists in codespell already? It is possi
You can select the optional dictionaries with the ``--builtin`` option.

Ignoring Words
--------------

When ignoring false positives, note that spelling errors are *case-insensitive* but words to ignore are *case-sensitive*. For example, the dictionary entry ``wrod`` will also match the typo ``Wrod``, but to ignore it you must pass ``wrod``.

The words to ignore can be passed in two ways:

1. ``-I``: A file with a word per line to ignore:

.. code-block:: sh
codespell -I FILE, --ignore-words=FILE
2. ``-L``: A comma separated list of words to ignore on the command line:

.. code-block:: sh
codespell -L word1,word2,word3,word4
Using a config file
-------------------

Expand Down

0 comments on commit bb09cb3

Please sign in to comment.