asottile /
pyupgrade
A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
88/100 healthLoading repository data…
asottile / repository
A tool (and pre-commit hook) to automatically add trailing commas to calls and literals.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
A tool (and pre-commit hook) to automatically add trailing commas to calls and literals.
pip install add-trailing-comma
See pre-commit for instructions
Sample .pre-commit-config.yaml:
- repo: https://github.com/asottile/add-trailing-comma
rev: v4.0.0
hooks:
- id: add-trailing-comma
# Sample of *ideal* syntax
function_call(
argument,
5 ** 5,
kwarg=foo,
)
*args / **kwargs)) has a trailing commaThis has the following benefits:
arbitrary indentation is avoided:
# I hear you like 15 space indents
# oh your function name changed? guess you get to reindent :)
very_long_call(arg,
arg,
arg)
adding / removing a parameter preserves git blame and is a minimal diff:
# with no trailing commas
x(
- arg
+ arg,
+ arg2
)
# with trailing commas
x(
arg,
+ arg2,
)
x(
arg,
- arg
+ arg,
)
x = [
- 1, 2, 3
+ 1, 2, 3,
]
def func(
arg1,
- arg2
+ arg2,
):
async def func(
arg1,
- arg2
+ arg2,
):
from imports from os import (
path,
- makedirs
+ makedirs,
)
class C(
Base1,
- Base2
+ Base2,
):
pass
with (
open('f1', 'r') as f1,
- open('f2', 'w') as f2
+ open('f2', 'w') as f2,
):
pass
match x:
case A(
1,
- 2
+ 2,
):
pass
case (
1,
- 2
+ 2,
):
pass
case [
1,
- 2
+ 2,
]:
pass
case {
'x': 1,
- 'y': 2
+ 'y': 2,
}:
pass
def f[
- T
+ T,
](x: T) -> T:
return x
class A[
- K
+ K,
]:
def __init__(self, x: T) -> None:
self.x = x
type ListOrSet[
- T
+ T,
] = list[T] | set[T]
x(
arg1,
- arg2)
+ arg2,
+)
-function_name(arg1,
- arg2)
+function_name(
+ arg1,
+ arg2,
+)
x = [
1,
2,
3,
- ]
+]
yes yes, I realize the tool is called add-trailing-comma :laughing:
-[1, 2, 3,]
-[1, 2, 3, ]
+[1, 2, 3]
+[1, 2, 3]
Selected from shared topics, language and repository description—not editorial ratings.
asottile /
A tool (and pre-commit hook) to automatically upgrade syntax for newer versions of the language.
88/100 healtha5chin /
A production-ready Python development environment template using modern tools: uv for blazing-fast package management, Ruff for lightning-fast linting and formatting, ty for fast and reliable type checking, and VSCode Dev Containers for reproducible development environments.
88/100 healthgauraang01 /
This project proposes a cost-effective solution for testing AWS CloudFormation templates in through open-source tools. By integrating cfn-lint, cfn-nag, cfn-guard, cloud-radar, and localstack into a CI/CD pipeline through pre-commit and utilizing github actions .
fchastanet /
AI Linter is a validation tool for AI skills and agent configurations. It enforces structure, frontmatter, content length, token limits, and file reference checks for SKILL.md and AGENTS.md files. Includes YAML config, pre-commit, and VS Code integration for robust, automated linting in AI projects
44/100 healthofficial-mary /
Production-ready Ansible dev workstation setup — isolated Python env, VS Code tooling, SSH config, Git hooks and pre-commit linting.
42/100 healthlukepoo101 /
Template Repository for a UV based python application with pre commit tools and ruff for linting.
37/100 health