How to use the pydocstyle.ConventionChecker function in pydocstyle

To help you get started, we’ve selected a few pydocstyle examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DamnWidget / anaconda / anaconda_lib / linting / anaconda_pep257.py View on Github external
def execute(self):
            """Check the code with pep257 to find errors
            """

            errors = []
            try:
                for error in pydocstyle.ConventionChecker().check_source(
                    self.code, self.filename
                ):
                    error_code = getattr(error, 'code', None)
                    if error_code is not None and error_code not in self.ignore:  # noqa
                        errors.append(self._convert(error))
            except Exception as error:
                print(error)

            return errors
github pylava / pylava / pylava / lint / pylava_pydocstyle.py View on Github external
:return list: List of errors.
        """
        if 'ignore_decorators' in params:
            ignore_decorators = params['ignore_decorators']
        else:
            ignore_decorators = None
        check_source_args = (code, path, ignore_decorators) if THIRD_ARG else (code, path)
        return [{
            'lnum': e.line,
            # Remove colon after error code ("D403: ..." => "D403 ...").
            'text': (e.message[0:4] + e.message[5:]
                     if e.message[4] == ':' else e.message),
            'type': 'D',
            'number': e.code
        } for e in PyDocChecker().check_source(*check_source_args)]
github PyCQA / flake8-docstrings / flake8_docstrings.py View on Github external
def __init__(self, tree, filename, lines):
        """Initialize the checker."""
        self.tree = tree
        self.filename = filename
        self.checker = pep257.ConventionChecker()
        self.source = ''.join(lines)