-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
T: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?
Description
Pylint error code: C0330 (bad-continuation; i.e. "Wrong hanging indentation before block")
Original code snippet
class CheckHandler(object):
def __init__(self, file, out_json, check_dir=u".", files=None): # type: (str, bool, str, typing.List[str]) -> None
# Do this here so setup.py doesn't error
from snekchek.baseconfig import config
import configobjExamples in the current Black style
class CheckHandler(object):
def __init__(
self, file, out_json, check_dir=u".", files=None
): # type: (str, bool, str, typing.List[str]) -> None
# Do this here so setup.py doesn't error
from snekchek.baseconfig import config
import configobjNote how the function parameters are on the same indentation level as the function body.
Desired style
# Ideal: comment moved down to fit width
# Note that getting this to work while preserving pylint/flake8 markers is quite the challenge
class CheckHandler(object):
def __init__(self, file, out_json, check_dir=u".", files=None):
# type: (str, bool, str, typing.List[str]) -> None
# Do this here so setup.py doesn't error
from snekchek.baseconfig import config
import configobj
# Alternatively, indent as recommended by pylint
class CheckHandler(object):
def __init__(
self, file, out_json, check_dir=u".", files=None
): # type: (str, bool, str, typing.List[str]) -> None
# Do this here so setup.py doesn't error
from snekchek.baseconfig import config
import configobjIt does this in various situations, but the core of the issue stays the same; The newer line ends up on the same indentation level as the function body
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
T: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?