Skip to content

Setup pre-commit hook for auto-formating both Python and C parts #1123

@asvetlov

Description

@asvetlov

The Python part could be the standard ruff.
Regarding C code, I personally prefer CPython formatting style.
It is not very formal, but I think we can setup https://zed0.co.uk/clang-format-configurator/ to get a config which is at least very close to CPython style.

The only challenge is figuring out the meaning of these dozens of options.

          might be nice to format the C code with something like https://github.com/ratgdo/esphome-ratgdo/blob/05967a5cb1e27341e55917188c79ca80a610da5f/.pre-commit-config.yaml#L10 as well (no preferences on the settings, other than to not have to think about it)

Originally posted by @bdraco in #1116 (comment)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions