Package: scspell3k
scspellis a spell checker for source code. This is an unofficial fork (ofhttps://launchpad.net/scspell) that runs on both Python 2 and 3.scspelldoes not try to be particularly smart–rather, it does the simplest
thing that can possibly work:All alphanumeric strings (strings of letters, numbers, and
underscores) are spell-checked tokens.Each token is split into one or more subtokens. Underscores and digits
always divide tokens, and capital letters will begin new subtokens. In
other words,some_variableandsomeVariablewill both generate
the subtoken list {some,variable}.All subtokens longer than three characters are matched against a set of
dictionaries, and a match failure prompts the user for action. When
matching against the included English dictionary,prefix matchingis
employed; this choice permits the use of truncated words likedictas valid subtokens.When applied to code written in most popular programming languages while using
typical naming conventions, this algorithm will usually catch many errors
without an annoying false positive rate.In an effort to catch more spelling errors,scspellis able to check each
file against a set of dictionary words selectedspecifically for that file. Up
to three different sub-dictionaries may be searched for any given file:A natural language dictionary. (scspellprovides an American
English dictionary as the default.)A programming language-specific dictionary, intended to contain
oddly-spelled keywords and APIs associated with that language.
(scspellprovides small default dictionaries for a number of popular
programming languages.)A file-specific dictionary, intended to contain uncommon strings which
are not likely to be found in more than a handful of unique files.UsageTo begin the spell checker, run$ scspell source_file1 source_file2 ...For each spell check failure, you will see output much like this:filename.c:27: Unmatched 'someMispeldVaraible' -> {mispeld, varaible}In other words, the token “someMispeldVaraible” was found on line 27
offilename.c, and it contains subtokens “mispeld” and
“varaible” which both failed the spell-checking algorithm. You will
be prompted for an action to take:(i)gnoreSkip to the next unmatched token, without taking any action.(I)gnore allSkip over this token every time it is encountered, for the
remainder of this spell check session.(r)eplaceEnter some text to use as a replacement for this token, and replace
only the token at this point in the file.(R)eplace allEnter some text to use as a replacement for this token, and replace
every occurrence of the token until the end of the current file.(a)dd to dictionaryAdd one or more tokens to one of the dictionaries (see below).show (c)ontextPrint out some lines of context surrounding the unmatched token.If you accidentally select a replacement operation, enter an empty
string to cancel.If you select the(a)dd to dictionaryoption, then you will be
prompted with the following options for every subtoken:(b)ackReturn to the previous menu, without taking any action.(i)gnoreSkip to the next subtoken, without taking any action.add to (p)rogramming language dictionaryAdd this subtoken to the dictionary associated with the
programming language of the current file.scspelluses the
file extension to determine the language, so you will only
see this option for files which have an extension.add to (f)ile-specific dictionaryAdd this subtoken to the dictionary associated with the
current file. You will see this option only for files which
have such an embedded ID or which have an entry in the file ID
mapping.  SeeCreating File IDsfor details.add to (N)ew file-specific dictionaryCreate a new file ID for the current file, record the new
file ID in the file ID mapping, and add this subtoken to a new
file-specific dictionary associated with that file ID.  You will
see this option only for files which have neither an embedded ID nor
an entry in the file ID mapping, and only if the--relative-tooption is given.  SeeCreating File IDsfor details.add to (n)atural language dictionaryAdd this subtoken to the natural language dictionary.If scspell finds no unknown tokens, it exits with exit status 0.  If
there were unknown tokens, it exits with exit status 1.  If it
terminates in response to a (handled) signal such as a SIGINT from ^C,
it exits with exit status 2.Spell-checking Options–report-onlyThis option causesscspellto report to stderr a report of the
subtokens that it considers to be in error, instead of offering the
interactive menu described above.  For each subtoken, the report
includes the filename, line number, and full token.scspellwill
exit with an exit code of 1 if any errors are found, or 0 if the run
was clean.The format of the reported errors is different than the interactive
mode reports them.  With--report-only, the above one would appear
like this:filename.c:27: 'mispeld', 'varaible' were not found in the dictionary (from token 'someMispeldVaraible')–no-c-escapesBy default,scspelltreats files as if they contain C-style
character escapes.  That is, givenprintf("Hello\nworld."), it will
consider the tokens “hello” and “world”, not “nworld”.The--no-c-escapesoption causesscspellto not treat\as a
special character, for e.g. LaTeX files where you might write\Alpha\beta\gamma\delta.  Without this option,scspellwould
see the tokens “lpha”, “eta”, “amma”, and “elta”.Creating File IDsIf you would likescspellto be able to uniquely identify a file,
thus enabling the creation of a file-specific dictionary, thenscspellmust be able to find a file ID to identify both the file
an the file-specific dictionary.  There are two waysscspellcan
find the file ID:The file ID may be embedded directly in the file, using a string of
the following form:scspell-id: <unique ID>An entry in the file ID mapping file ties a filename to a file ID.The unique ID must consist only of letters, numbers, underscores, and dashes.scspellcan generate suitable unique ID strings using the--gen-idoption:$ scspell --gen-id
scspell-id: e497803c-523a-11de-ae42-0017f2ee0f37(Most likely you will want to place a file’s unique ID inside a source code comment.)During interactive use, the(a)dd to dictionary->add to (N)ewfile-specificdictionaryoption will create a new File ID for the
current file, and add it to the file ID mapping file.–relative-to RELATIVE_TOThe filenames stored in the file ID mapping are relative paths.  This
option specifies what they’re relative to.  If this option is not
specified, the file ID mapping will not be consulted, and theadd to (N)ewfile-specificdictionaryoption will not be offered.Managing File IDsThese options directscspellto manipulate the file ID mapping.
(These can all be accomplished by editing the file ID mapping
manually).  These have no effect on file IDs embedded in files.–rename-file FROM_FILE TO_FILEChanges the filename that a File ID maps to.  After renaming a file
that has a file-specific dictionary and an entry in the file ID
mapping, you can use this option to have the entry “follow” the file.–delete-filesRemove filenames from the file ID mapping.  If it was the only
filename for a given File ID, removes the File ID from the mapping and
its wordlist from the dictionary.–merge-file-ids FROM_ID TO_IDCombines the file-specific dictionaries referenced by the two File
IDs.  All words from FROM_IDs list are moved to TO_IDs.  The FROM_ID
File ID is removed from the mapping, and any files using it are
changed to use TO_ID.  Either FROM_ID or TO_ID may be given as a filename
instead, in which case that file’s File ID is used for that parameter.Sharing a DictionaryA team of developers working on the same source tree may wish to share a common
dictionary. You can permanently set the location of a shared dictionary by
executing$ scspell --set-dictionary=/path/to/dictionary_file.txtThe dictionary is formatted as a simple newline-separated list of words, so it
can easily be managed by a version control system if desired.The current dictionary can be saved to a file by executing$ scspell --export-dictionary=/path/to/output_file.txtYou can also override the dictionary location for a single spell check session,
by using the--override-dictionaryoption:$ scspell --override-dictionary=/path/to/dictionary_file.txt source_file1 ...–base-dict BASE_DICTAbase dictionaryis consulted for its words, but is not modified
at runtime.  By using$ scspell –base-dict ~/.dict –override-dictionary proj/.dict source…words added at runtime will be added toproj/.dict, and~/.dictwill be left alone.  This wayproj/.dictmay be
limited only to the words added forproj/.  This may be more
convenient whenproj/.dictis committed to source control and
shared by many users.–use-builtin-base-dictUse the dictionary file shipped with scspell as a base dictionary.–filter-out-base-dictsRead the dictionary specified by the normal dictionary selection
options, called theproject dicthere.  Read the base
dictionaries specified by the base-dict options.  Remove from the
project dict all the words from the base dicts, and write the
project dict back out.This may be useful when a project dict has been generated with an
older version ofscspellthat did not support base dicts.InstallationInstallscspellvia pip:$ pip install scspell3kAlternatively, download and unpack the source archive, switch to the
archive root directory, and run the installation script:$ python setup.py installOn a UNIX-like system, you may need to usesudoif installing to a
directory that requires root privileges:$ sudo python setup.py installLicensescspellis Free Software, licensed under Version 2 of the GNU General
Public License; seeCOPYING.txtfor details.The English dictionary distributed with scspell is derived from theSCOWL word lists. SeeSCOWL-LICENSE.txtfor the myriad licenses that apply to that dictionary.