Skip to content

Developers: please don't outdent return statements #1208

@rrthomas

Description

@rrthomas

While making some fairly large changes recently, I frequently had to double-check that I'd understood control flow owing to outdented (left-margin) return statements.

I asked @davelab6 about this, and he agreed. I can see why it was done originally: it helps makes returns stand out in long functions. The real solution is not to write such long or complex functions.

Hence, in new code please indent return normally. Similarly, feel free to change existing statements when you're editing existing code (a good rule of thumb is to change them if they are in a + or - line of a diff).

I've added a note about this to the new web site's developer documentation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions