asottile / add-trailing-comma

A tool (and pre-commit hook) to automatically add trailing commas to calls and literals.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Adding trailing comma to function with single argument

Jarvis1Tube opened this issue · comments

commented

Before add-trailing-comma

def g(dict_representation):
    assert (
        set(dict_representation["cli"].pop("characteristics")
            ) == set(cli_data.pop("characteristics"))
    )

after add-trailing-comma

def g(dict_representation):
    assert (
        set(
            dict_representation["cli"].pop("characteristics"), # there should not be any comma, because set() gets only one parameter
        ) == set(cli_data.pop("characteristics"))
    )

nope, this is correct

even functions currently taking one argument should receive trailing comma treatment in case another argument were to be added later

no special cases

commented

Thanks for answer. It very kind of you. Isn't there any possibility to check count of arguments at time or running add-trailing-comma? вт, 20 окт. 2020 г., 18:13 Anthony Sottile notifications@github.com:

no special cases — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub <#100 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/AC2SFKWQ6GGBZ3F22M23W4TSLWSIBANCNFSM4SYFAKKQ .

not without solving the halting problem, no