Package epydoc :: Module checker :: Class DocChecker
[show private | hide private]
[frames | no frames]

Class DocChecker


Documentation completeness checker. DocChecker can be used to check that specified classes of objects are documented. To check the documentation for a group of objects, you should create a DocChecker from a DocMap that documents those objects; and then use the check method to run specified checks on the objects' documentation.

What checks are run, and what objects they are run on, are specified by the constants defined by DocChecker. These constants are divided into three groups. The check method is used to perform a check on the documentation. Its parameter is formed by or-ing together at least one value from each specifier group:
>>> checker.check(DocChecker.MODULE | DocChecker.PUBLIC |
...               DocChecker.DESCR)
To specify multiple values from a single group, simply or their values together:
>>> checker.check(DocChecker.MODULE | DocChecker.CLASS |
...               DocChecker.FUNC | DocChecker.DESCR_LAZY |
...               DocChecker.PUBLIC)

Method Summary
  __init__(self, docmap)
Create a new DocChecker that can be used to run checks on the documentation of the objects documented by docmap
boolean check(self, checks)
Run the specified checks on the documentation of the objects contained by this DocChecker's DocMap.
None _check_basic(self, doc)
Check the description, author, version, and see-also fields of doc.
None _check_class(self, doc)
Run checks on the class whose UID is doc.
None _check_func(self, doc)
Run checks on the function whose UID is doc.
None _check_module(self, doc)
Run checks on the module whose UID is doc.
boolean _check_name_publicity(self, name)
Return true if an object named name should be checked, given the public/private specifiers.
  _check_property(self, doc)
None _check_var(self, var, name, check_type)
Run checks on the variable whose documentation is var and whose name is name.
None _warn(self, error, name)
Print a warning about the object named name.

Class Variable Summary
int ALL = 65791                                                                 
int PROPERTY = 256                                                                   
int _DESCR_STRICT = 8192                                                                  
    Types
int MODULE: Type specifier that indicates that the documentation of modules should be checked.
int CLASS: Type specifier that indicates that the documentation of classes should be checked.
int FUNC: Type specifier that indicates that the documentation of functions should be checked.
int VAR: Type specifier that indicates that the documentation of module variables should be checked.
int IVAR: Type specifier that indicates that the documentation of instance variables should be checked.
int CVAR: Type specifier that indicates that the documentation of class variables should be checked.
int PARAM: Type specifier that indicates that the documentation of function and method parameters should be checked.
int RETURN: Type specifier that indicates that the documentation of return values should be checked.
int ALL_T: Type specifier that indicates that the documentation of all objects should be checked.
    Checks
int TYPE: Check specifier that indicates that every variable and parameter should have a @type field.
int AUTHOR: Check specifier that indicates that every object should have an author field.
int VERSION: Check specifier that indicates that every object should have a version field.
int DESCR_LAZY: Check specifier that indicates that every object should have a description.
int DESCR: Check specifier that indicates that every object should have a description.
int ALL_C: Check specifier that indicates that all checks should be run.
    Publicity
int PUBLIC: Specifier that indicates that public objects should be checked.
int PRIVATE: Specifier that indicates that private objects should be checked.
int ALL_P: Specifier that indicates that both public and private objects should be checked.

Method Details

__init__(self, docmap)
(Constructor)

Create a new DocChecker that can be used to run checks on the documentation of the objects documented by docmap
Parameters:
docmap - A documentation map containing the documentation for the objects to be checked.
           (type=DocMap)

check(self, checks=None)

Run the specified checks on the documentation of the objects contained by this DocChecker's DocMap. Any errors found are printed to standard out.
Parameters:
checks - The checks that should be run on the documentation. This value is constructed by or-ing together the specifiers that indicate which objects should be checked, and which checks should be run. See the module description for more information. If no checks are specified, then a default set of checks will be run.
           (type=int)
Returns:
True if no problems were found.
           (type=boolean)

_check_basic(self, doc)

Check the description, author, version, and see-also fields of doc. This is used as a helper function by _check_module, _check_class, and _check_func.
Parameters:
doc - The documentation that should be checked.
           (type=ObjDoc)
Returns:
None

_check_class(self, doc)

Run checks on the class whose UID is doc.
Parameters:
doc - The UID of the class to check.
           (type=UID)
Returns:
None

_check_func(self, doc)

Run checks on the function whose UID is doc.
Parameters:
doc - The UID of the function to check.
           (type=UID)
Returns:
None

_check_module(self, doc)

Run checks on the module whose UID is doc.
Parameters:
doc - The UID of the module to check.
           (type=UID)
Returns:
None

_check_name_publicity(self, name)

Parameters:
name - The name of the object to check.
           (type=string)
Returns:
True if an object named name should be checked, given the public/private specifiers.
           (type=boolean)

_check_var(self, var, name, check_type=1)

Run checks on the variable whose documentation is var and whose name is name.
Parameters:
var - The documentation for the variable to check.
           (type=Var)
name - The name of the variable to check.
           (type=string)
check_type - Whether or not the variable's type should be checked. This is used to allow varargs and keyword parameters to have no type specified.
Returns:
None

_warn(self, error, name)

Print a warning about the object named name.
Parameters:
error - The error message to print.
           (type=string)
name - The name of the object that generated the warning.
           (type=string)
Returns:
None

Class Variable Details

MODULE

Type specifier that indicates that the documentation of modules should be checked.
Type:
int
Value:
1                                                                     

CLASS

Type specifier that indicates that the documentation of classes should be checked.
Type:
int
Value:
2                                                                     

FUNC

Type specifier that indicates that the documentation of functions should be checked.
Type:
int
Value:
4                                                                     

VAR

Type specifier that indicates that the documentation of module variables should be checked.
Type:
int
Value:
8                                                                     

IVAR

Type specifier that indicates that the documentation of instance variables should be checked.
Type:
int
Value:
16                                                                    

CVAR

Type specifier that indicates that the documentation of class variables should be checked.
Type:
int
Value:
32                                                                    

PARAM

Type specifier that indicates that the documentation of function and method parameters should be checked.
Type:
int
Value:
64                                                                    

RETURN

Type specifier that indicates that the documentation of return values should be checked.
Type:
int
Value:
128                                                                   

ALL_T

Type specifier that indicates that the documentation of all objects should be checked.
Type:
int
Value:
511                                                                   

TYPE

Check specifier that indicates that every variable and parameter should have a @type field.
Type:
int
Value:
256                                                                   

AUTHOR

Check specifier that indicates that every object should have an author field.
Type:
int
Value:
1024                                                                  

VERSION

Check specifier that indicates that every object should have a version field.
Type:
int
Value:
2048                                                                  

DESCR_LAZY

Check specifier that indicates that every object should have a description. However, it is permissible for functions and methods that have a @return field to not have a description, since a description may be generated from the @return field.
Type:
int
Value:
4096                                                                  

DESCR

Check specifier that indicates that every object should have a description.
Type:
int
Value:
12288                                                                 

ALL_C

Check specifier that indicates that all checks should be run.
Type:
int
Value:
16128                                                                 

PUBLIC

Specifier that indicates that public objects should be checked.
Type:
int
Value:
32768                                                                 

PRIVATE

Specifier that indicates that private objects should be checked.
Type:
int
Value:
16384                                                                 

ALL_P

Specifier that indicates that both public and private objects should be checked.
Type:
int
Value:
49152                                                                 

ALL

Type:
int
Value:
65791                                                                 

PROPERTY

Type:
int
Value:
256                                                                   

_DESCR_STRICT

Type:
int
Value:
8192                                                                  

Generated by Epydoc 2.1 on Sat Mar 20 17:46:18 2004 http://epydoc.sf.net