Skip to content

DOC503 picks up exception facilities #174

@nicholasjng

Description

@nicholasjng

Hey! We're using pydoclint with pre-commit in one of our projects, and got some linter errors with the latest release.

Those errors have to do with us using an "exception translator" function, which takes an exception coming from an API client, translates it into a builtin Python error, and then raises the translated error. For example, an HTTP403 (forbidden) would become a PermissionError.

You can find an example here: https://github.com/aai-institute/lakefs-spec/blob/d271df45654a239bacf482338ea8febe5c029886/src/lakefs_spec/spec.py#L356-L357

pydoclint picks this up and reports it as an undocumented exception type. But, of course, we do not want to document this implementation detail, since the user is never supposed to see API errors.

Following this rationale, in the AST analysis, non-exception types (as like in our case, e.g., a function translating exceptions) should not be reported as errors. What do you think?

Error message:

    142: DOC503: Method `LakeFSFileSystem.wrapped_api_call` exceptions in the "Raises" section in the docstring do not match those in the function body Raises values in the docstring: ['OSError']. Raised exceptions in the body: ['translate_lakefs_error'].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions