@@ -11,36 +11,66 @@ Here is how it is typically run:
1111
1212 python comment_spell_check.py --exclude Ancillary $SIMPLEITK_SOURCE_DIR/Code
1313
14- This command will recursively find all the '.h' files in a directory,
14+ This command will recursively find all the \ ' .h\ ' files in a directory,
1515extract the C/C++ comments from the code, and run a spell checker on them.
16- The ** '- -exclude'** flag tells the script to ignore any file that has
17- 'Ancillary' in its full path name. This flag will accept any
16+ The ** \'\-\ - exclude\ '** flag tells the script to ignore any file that has
17+ \ ' Ancillary\ ' in its full path name. This flag will accept any
1818regular expression.
1919
20- In addition to pyenchant's English dictionary, we use the words in
20+ In addition to pyenchant\ ' s English dictionary, we use the words in
2121** additional_dictionary.txt** . These words are proper names and
2222technical terms harvest by hand from the SimpleITK and ITK code bases.
2323
2424If a word is not found in the dictionaries, we try two additional checks.
2525
26261 . If the word starts with some known prefix, the prefix is removed
27- ... and the remaining word is checked against the dictionary. The prefixes
28- ... used by default are ** 'sitk'** , ** 'itk'** , and ** 'vtk'** . Additional
29- ... prefixes can be specified with the ** '- -prefix'** command line argument.
27+ and the remaining word is checked against the dictionary. The prefixes
28+ used by default are ** \ ' sitk\ '** , ** \ ' itk\ '** , and ** \ ' vtk\ '** . Additional
29+ prefixes can be specified with the ** \'\-\ - prefix\ '** command line argument.
3030
31312 . We attempt to split the word by capitalization and check each
32- ... sub-word against the dictionary. This method is an attempt to detect
33- ... camel-case words such as 'GetArrayFromImage', which would get split into
34- ... 'Get', 'Array', 'From', and 'Image'. Camel-case words are very commonly
35- ... used for code elements.
32+ sub\ - word against the dictionary. This method is an attempt to detect
33+ camel-case words such as \ ' GetArrayFromImage\ ' , which would get split into
34+ \ ' Get\ ' , \ ' Array\ ' , \ ' From\ ' , and \ ' Image\ ' . Camel-case words are very commonly
35+ used for code elements.
3636
37- The script can also process other file types. With the ** '- -suffix'**
37+ The script can also process other file types. With the ** \'\-\ - suffix\ '**
3838option, the following file types are available: Python (.py), C/C++
3939(.c/.cxx), CSharp (.cs), Text (.txt), reStructuredText(.rst), Markdown (.md),
4040Ruby (.ruby), R (.R), and Java (.java). Note that reStructuredText files are
4141treated as standard text. Consequentially, all markup keywords that are not
4242actual words will need to be added to the additional/exception dictionary.
4343
44+ ## Disabling Spell Checking
45+
46+ Spell checking can be disabled for sections of code by using special
47+
48+ comments. The following comments will disable spell checking until
49+ the corresponding end comment is found.
50+ ```
51+ // spell-check-disable
52+
53+ // This comment will not be spell checked.
54+
55+ // spell-check-enable
56+ ```
57+
58+ Note that for C-style, multi-line comments, the disable and enable
59+ comments must be in seperate comments. If the disable command
60+ is found in a multi-line comment, spell checking will be
61+ disabled for the entire multi-line comment.
62+
63+ ```
64+ /*
65+ spell-check-disable
66+ spell-check-enable
67+ This comment will NOT be spell checked
68+ */
69+ /* spell-check-enable */
70+ /* This comment WILL be spell checked */
71+ ```
72+
73+
4474## Dictionary notes
4575
4676We use [ PySpellChecker] ( https://github.com/barrust/pyspellchecker ) as the
0 commit comments