How to use the pydocstyle.parser.ParseError 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 palantir / python-language-server / pyls / plugins / pydocstyle_lint.py View on Github external
# TODO(gatesn): We can add more pydocstyle args here from our pyls config
        conf.parse()

    # Will only yield a single filename, the document path
    diags = []
    for filename, checked_codes, ignore_decorators in conf.get_files_to_check():
        errors = pydocstyle.checker.ConventionChecker().check_source(
            document.source, filename, ignore_decorators=ignore_decorators
        )

        try:
            for error in errors:
                if error.code not in checked_codes:
                    continue
                diags.append(_parse_diagnostic(document, error))
        except pydocstyle.parser.ParseError:
            # In the case we cannot parse the Python file, just continue
            pass

    log.debug("Got pydocstyle errors: %s", diags)
    return diags
github jayclassless / tidypy / src / tidypy / tools / pydocstyle.py View on Github external
def make_issue(self, error, filename):
        if isinstance(error, Error):
            return PyDocStyleIssue(
                error.code,
                error.short_desc,
                filename,
                error.line,
            )

        if isinstance(error, EnvironmentError):
            return AccessIssue(error, filename)

        if isinstance(error, (AllError, ParseError, SyntaxError)):
            return ParseIssue(error, filename)

        return UnknownIssue(error, filename)
github pymedphys / pymedphys / app / packages / pyodide-language-server / pyls / plugins / pydocstyle_lint.py View on Github external
# TODO(gatesn): We can add more pydocstyle args here from our pyls config
        conf.parse()

    # Will only yield a single filename, the document path
    diags = []
    for filename, checked_codes, ignore_decorators in conf.get_files_to_check():
        errors = pydocstyle.checker.ConventionChecker().check_source(
            document.source, filename, ignore_decorators=ignore_decorators
        )

        try:
            for error in errors:
                if error.code not in checked_codes:
                    continue
                diags.append(_parse_diagnostic(document, error))
        except pydocstyle.parser.ParseError:
            # In the case we cannot parse the Python file, just continue
            pass

    log.debug("Got pydocstyle errors: %s", diags)
    return diags