Skip to content
This repository has been archived by the owner on Dec 16, 2022. It is now read-only.

Support backticks for arguments in Sphinx style #170

Open
kalibyrn opened this issue Jun 23, 2021 · 0 comments
Open

Support backticks for arguments in Sphinx style #170

kalibyrn opened this issue Jun 23, 2021 · 0 comments

Comments

@kalibyrn
Copy link

Given the following function:

def key_if_required(key: str, required: bool = True) -> dict:
    """
    Check if key is required and return a dictionary.

    :param `key`: The name of the key to check
    :param `required`: Whether the key is required or not
    :returns: Dictionary
    """
    if key not in ["dogs", "cats"]:
        return {"default": key}
    return {"required": required}

darglint will report these errors when using Sphinx formatting:

test_me.py:key_if_required:4: DAR102: + `key`
test_me.py:key_if_required:4: DAR102: + `required`
test_me.py:key_if_required:4: DAR101: - key
test_me.py:key_if_required:4: DAR101: - required

The backticks are nice because they allow highlighting in editors. If there were an option to ignore backticks for arguments that would be great.

image

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant