Black: Comma placement wonky when comment block between code and comma

Created on 22 Aug 2018  路  3Comments  路  Source: psf/black

Operating system: Windows 10 1803 x64
Python version: 3.6.5
Black version: 18.6b4
Does also happen on master: Yes.

The following __init__ parameter list uses funky formatting that places commas on the next line instead of where they should be: https://github.com/googlefonts/fontbakery/blob/master/Lib/fontbakery/reporters/terminal.py#L174

This gets reformatted as

    def __init__(
        self,
        print_progress=True,
        stdout=sys.stdout,
        structure_threshold=None,
        usecolor=True,
        unicorn=True
        # a tuple of structural statuses to be skipped
        # e.g. (STARTSECTION, ENDSECTION)
        ,
        skip_status_report=None,
        **kwd,
    ):

The comma should probably be moved before the comment block... Weird corner case, yeah, but I thought I should report it.

enhancement help wanted

Most helpful comment

It's not a bug, it's a feature request. The input looks like this:

class TerminalProgress(FontbakeryReporter):
  def __init__(self, print_progress=True
                   , stdout=sys.stdout
                   , structure_threshold=None
                   , usecolor=True
                   , unicorn=True
                     # a tuple of structural statuses to be skipped
                     # e.g. (STARTSECTION, ENDSECTION)
                   , skip_status_report=None
                   , **kwd):

I'm not even mad, I'm impressed.

All 3 comments

It's not a bug, it's a feature request. The input looks like this:

class TerminalProgress(FontbakeryReporter):
  def __init__(self, print_progress=True
                   , stdout=sys.stdout
                   , structure_threshold=None
                   , usecolor=True
                   , unicorn=True
                     # a tuple of structural statuses to be skipped
                     # e.g. (STARTSECTION, ENDSECTION)
                   , skip_status_report=None
                   , **kwd):

I'm not even mad, I'm impressed.

Hi @ambv, Can I work on this?

@areebahmed04 contributions are welcome!

Was this page helpful?
0 / 5 - 0 ratings