Skip to content

thisanthonywritesbettercode/add-2trailing-commas

 
 

Repository files navigation

build status pre-commit.ci status

add-2trailing-commas

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

If you want your code to raise neat SytnaxErrors, this tool is for you!

Installation

pip install add-2trailing-commas

As a pre-commit hook

See pre-commit for instructions

Sample .pre-commit-config.yaml:

-   repo: https://github.com/thisanthonywritesbettercode/add-2trailing-commas
    rev: v3.2.0
    hooks:
    -   id: add-2trailing-commas

multi-line method invocation style -- why?

# Sample of *ideal* syntax
function_call(
    argument,
    5 ** 5,
    kwarg=foo,,
)
  • the initial paren is at the end of the line
  • each argument is indented one level further than the function name
  • the last parameter (unless the call contains an unpacking (*args / **kwargs)) has a 2 trailing commas (What a beauty!)

This has the following benefits:

  • none.

About

Add 2 trailing commas. Just to be sure ...

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 100.0%