I use Python since 2001, and I am very used to %s
string formatting.
In my current environment code should be formatted with f-strings.
How to automatically check my code, so I don't accidentally use my old habit?
I use Python since 2001, and I am very used to %s
string formatting.
In my current environment code should be formatted with f-strings.
How to automatically check my code, so I don't accidentally use my old habit?
I use pyupgrade as a pre-commit hook https://github.com/asottile/pyupgrade
Sample .pre-commit-config.yaml:
- repo: https://github.com/asottile/pyupgrade
rev: v2.10.0
hooks:
- id: pyupgrade
You can use this pre-commit.com config
.pre-commit-config.yaml
:
- repo: local
hooks:
- id: dont-use-%s-formatting
name: Do not use %s formatting any more
entry: \%s
language: pygrep
types: [text]