Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enforce consistent typing syntax #3812

Open
szokeasaurusrex opened this issue Nov 21, 2024 · 0 comments
Open

Enforce consistent typing syntax #3812

szokeasaurusrex opened this issue Nov 21, 2024 · 0 comments
Labels
Component: DX Dealing with developer experience

Comments

@szokeasaurusrex
Copy link
Member

As of when this issue is being written, we use type comments in our type hints, rather than the new Python type annotations:

# Conforms with our coding style
def foo(num, name):
    # type: (int, str) -> str
    return f"{num} is {name}'s favorite number"

# Does not conform with our coding style
def bar(num: int, name: str) -> str:
    return f"{num} is {name}'s favorite number"

We have had some instances of the non-conformant form getting through code review (e.g. #3717). So that we don't need to rely on human-error-prone manual verification that we use the conformant syntax, we should introduce automated checks to enforce our preferred style.

If we change our preferred syntax before we get around to implementing this issue, then we should enforce that syntax instead.

@szokeasaurusrex szokeasaurusrex added Good first issue Good for newcomers Component: DX Dealing with developer experience and removed Good first issue Good for newcomers labels Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: DX Dealing with developer experience
Projects
None yet
Development

No branches or pull requests

1 participant