Код: Выделить всё
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.4.9
hooks:
- id: ruff
args: [ --fix ]
- id: ruff-format
Код: Выделить всё
"""Module contains functions related to greetings."""
def get_greeting(name: str) -> str:
"""Return a greeting message.
Args
name (str): Name of the person to greet.
Returns
str: A greeting message.
"""
return f"Hello, {name}!"
def hello() -> str:
return "hello"
Код: Выделить всё
a.py:8:5: D416 [*] Section name should end with a colon ("Args")
a.py:12:5: D416 [*] Section name should end with a colon ("Returns")
a.py:20:5: D103 Missing docstring in public function
Found 3 errors.
[*] 2 fixable with the `--fix` option.
Подробнее здесь: https://stackoverflow.com/questions/786 ... ommit-hook
Мобильная версия