Fred Drake | 155348b | 2000-02-23 15:44:08 +0000 | [diff] [blame] | 1 | \section{\module{tabnanny} --- |
| 2 | Detection of ambiguous indentation} |
| 3 | |
| 4 | % rudimentary documentation based on module comments, by Peter Funk |
| 5 | % <pf@artcom-gmbh.de> |
| 6 | |
| 7 | \declaremodule{standard}{tabnanny} |
| 8 | \modulesynopsis{Tool for detecting white space related problems |
| 9 | in Python source files in a directory tree.} |
Fred Drake | 4271310 | 2003-12-30 16:15:35 +0000 | [diff] [blame] | 10 | \moduleauthor{Tim Peters}{tim_one@users.sourceforge.net} |
Fred Drake | 155348b | 2000-02-23 15:44:08 +0000 | [diff] [blame] | 11 | \sectionauthor{Peter Funk}{pf@artcom-gmbh.de} |
| 12 | |
| 13 | For the time being this module is intended to be called as a script. |
| 14 | However it is possible to import it into an IDE and use the function |
| 15 | \function{check()} described below. |
| 16 | |
Fred Drake | 0aa811c | 2001-10-20 04:24:09 +0000 | [diff] [blame] | 17 | \warning{The API provided by this module is likely to change |
| 18 | in future releases; such changes may not be backward compatible.} |
Fred Drake | 155348b | 2000-02-23 15:44:08 +0000 | [diff] [blame] | 19 | |
| 20 | \begin{funcdesc}{check}{file_or_dir} |
| 21 | If \var{file_or_dir} is a directory and not a symbolic link, then |
| 22 | recursively descend the directory tree named by \var{file_or_dir}, |
| 23 | checking all \file{.py} files along the way. If \var{file_or_dir} |
| 24 | is an ordinary Python source file, it is checked for whitespace |
| 25 | related problems. The diagnostic messages are written to standard |
| 26 | output using the print statement. |
| 27 | \end{funcdesc} |
| 28 | |
| 29 | |
| 30 | \begin{datadesc}{verbose} |
| 31 | Flag indicating whether to print verbose messages. |
Neal Norwitz | d3dab2b | 2002-04-05 02:21:09 +0000 | [diff] [blame] | 32 | This is incremented by the \code{-v} option if called as a script. |
Fred Drake | 155348b | 2000-02-23 15:44:08 +0000 | [diff] [blame] | 33 | \end{datadesc} |
| 34 | |
| 35 | |
| 36 | \begin{datadesc}{filename_only} |
| 37 | Flag indicating whether to print only the filenames of files |
| 38 | containing whitespace related problems. This is set to true by the |
| 39 | \code{-q} option if called as a script. |
| 40 | \end{datadesc} |
| 41 | |
| 42 | |
| 43 | \begin{excdesc}{NannyNag} |
| 44 | Raised by \function{tokeneater()} if detecting an ambiguous indent. |
| 45 | Captured and handled in \function{check()}. |
| 46 | \end{excdesc} |
| 47 | |
| 48 | |
| 49 | \begin{funcdesc}{tokeneater}{type, token, start, end, line} |
| 50 | This function is used by \function{check()} as a callback parameter to |
| 51 | the function \function{tokenize.tokenize()}. |
| 52 | \end{funcdesc} |
| 53 | |
| 54 | % XXX FIXME: Document \function{errprint}, |
| 55 | % \function{format_witnesses} \class{Whitespace} |
| 56 | % check_equal, indents |
| 57 | % \function{reset_globals} |
| 58 | |
| 59 | \begin{seealso} |
| 60 | \seemodule{tokenize}{Lexical scanner for Python source code.} |
| 61 | % XXX may be add a reference to IDLE? |
| 62 | \end{seealso} |