Skip to content
This repository was archived by the owner on Oct 30, 2026. It is now read-only.
This repository was archived by the owner on Oct 30, 2026. It is now read-only.

Linter: function parameters and line breaks #18

Open

Description

@JasonMWhite

When a function declaration uses type hints and needs to break across lines to stay within the character limit, we should have one parameter per line.

e.g.

def foo(self,
        bar: int,
        baz: str,
        qux: typing.Dict[str, typing.List[int]]) -> bool

    return True

and not:

def foo(self, bar: int, baz: str,
        qux: typing.Dict[str, typing.List[int]]) -> bool
    return True

As discussed https://github.com/Shopify/data_bang/pull/97#discussion_r105196063

@erikwright @honkfestival @cfournie does that about sum it up?

Activity

  1. honkfestival commented on Mar 9, 2017

    @honkfestival

    and needs to break across lines to stay within the character limit

    I might even go so far as to say when it has more than two (2) typed parameters.

  2. JasonMWhite commented on Mar 9, 2017

    @JasonMWhite
    Author

    I'm ambivalent. @cfournie care to weigh in?

  3. cfournie commented on Mar 10, 2017

    @cfournie
    Contributor

    When using the Python 2 function type annotations, matching names to types becomes difficult after two typed parameters and one parameter and comment per line would alleviate that difficulty.

    Using the Python 3 annotations I agree more with using one-param per line after 2 types parameters after reading these examples:

    def foo(self,
            bar: int,
            baz: str,
            qux: long) -> bool
        return True
    def foo(self, bar: int, baz: str, qux: long) -> bool
        return True
  4. erikwright commented on Mar 10, 2017

    @erikwright
    Contributor

    Those examples are pretty compelling, @cfournie .

  5. JasonMWhite commented on Mar 10, 2017

    @JasonMWhite
    Author

    Then we're agreed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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