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

Already on GitHub? Sign in to your account

E127 on long if statements #81

Closed
scarvalhojr opened this Issue Jun 15, 2012 · 2 comments

Comments

Projects
None yet
3 participants
def myfunction(some_very_very_very_long_variable_name,
               another_very_long_variable_name,
               var):

    # This raises an E127 and I can't find a way to get the identation right
    if some_very_very_very_long_variable_name or var \
    or another_very_long_variable_name:
        raise Exception()

    # This is accepted
    if some_very_very_very_long_variable_name or var[0] \
    or another_very_long_variable_name:
        raise Exception()
Member

myint commented Jun 15, 2012

@scarvalhojr, see below.

def myfunction(some_very_very_very_long_variable_name,
               another_very_long_variable_name,
               var):

    if some_very_very_very_long_variable_name or var \
            or another_very_long_variable_name:
        raise Exception()

    if some_very_very_very_long_variable_name or var[0] \
            or another_very_long_variable_name:
        raise Exception()

Though, I think using parentheses instead of escaping newlines would probably be cleaner.

Contributor

florentx commented Jun 15, 2012

Thank you for this report.

The 2 cases above will be added to the test suite, and we need to reject them with the appropriate error code.
The compliant forms are below:

def myfunction(some_very_very_very_long_variable_name,
               another_very_long_variable_name,
               var):

    if some_very_very_very_long_variable_name or var or \
            another_very_long_variable_name:
        raise Exception()

    if (some_very_very_very_long_variable_name or var or
            another_very_long_variable_name):
        raise Exception()

    if ((some_very_very_very_long_variable_name or var or
         another_very_long_variable_name)):
        raise Exception()

florentx added a commit that referenced this issue Jun 15, 2012

@florentx florentx closed this Jun 16, 2012

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