howtos:how_to_format_code
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| howtos:how_to_format_code [2026-12-01 11:59 pm] – [Automated formatting: pre-commit] hcho | howtos:how_to_format_code [2026-12-02 12:05 am] (current) – hcho | ||
|---|---|---|---|
| Line 191: | Line 191: | ||
| If any formatter modifies files during a commit, the commit is aborted. Review and stage the formatted files before committing again. | If any formatter modifies files during a commit, the commit is aborted. Review and stage the formatted files before committing again. | ||
| - | |||
| - | We use this config file '' | ||
| - | <code yaml> | ||
| - | repos: | ||
| - | # Basic file hygiene | ||
| - | - repo: https:// | ||
| - | rev: v6.0.0 | ||
| - | hooks: | ||
| - | - id: trailing-whitespace | ||
| - | - id: end-of-file-fixer | ||
| - | |||
| - | # Python: Black | ||
| - | - repo: https:// | ||
| - | rev: 26.10.1 | ||
| - | hooks: | ||
| - | - id: black | ||
| - | |||
| - | # R: Air | ||
| - | - repo: https:// | ||
| - | rev: " | ||
| - | hooks: | ||
| - | - id: air-format | ||
| - | |||
| - | # Shell: shfmt | ||
| - | - repo: https:// | ||
| - | rev: v3.15.0-1 | ||
| - | hooks: | ||
| - | - id: shfmt | ||
| - | |||
| - | # C/C++/CUDA: clang-format | ||
| - | - repo: https:// | ||
| - | rev: v23.1.5 | ||
| - | hooks: | ||
| - | - id: clang-format | ||
| - | types_or: [c, c++, cuda] | ||
| - | |||
| - | # JavaScript/ | ||
| - | - repo: https:// | ||
| - | rev: v3.10.1 | ||
| - | hooks: | ||
| - | - id: prettier | ||
| - | types_or: [javascript, | ||
| - | | ||
| - | |||
| - | # TOML: Tombi | ||
| - | - repo: https:// | ||
| - | rev: v1.11.3 | ||
| - | hooks: | ||
| - | - id: tombi-format | ||
| - | |||
| - | |||
| - | # CMake: cmake-format | ||
| - | - repo: https:// | ||
| - | rev: v0.6.13 | ||
| - | hooks: | ||
| - | - id: cmake-format | ||
| - | |||
| - | # Makefile: mbake | ||
| - | - repo: https:// | ||
| - | rev: v1.5.0 | ||
| - | hooks: | ||
| - | - id: mbake-format | ||
| - | |||
| - | </ | ||
| ===== Notes ===== | ===== Notes ===== | ||
howtos/how_to_format_code.1796169563.txt.gz · Last modified: by hcho