Skip to content

コードのフォーマットについて #239

Description

@kyo0221

clang-formatの導入を検討しています
今のところ以下の内容で考えているのですが,各自の環境でもフォーマットしてみて意見を伺いたいです
(そもそもコードのフォーマットが必要か,という意見でも良いです)

Language: Cpp # 対象はc++
BasedOnStyle: Google  # Google style guideをベースとする
ColumnLimit: 0  # 1行の文字数(0は無制限)
IndentWidth: 4  # インデントの空白数
AlignConsecutiveAssignments: true  # 連続する代入文の=の位置を揃える
AlignConsecutiveDeclarations: true  # 連続する変数宣言の変数名の位置を揃える

IncludeCategories:
  # C++ system headers
  - Regex: <[a-z_]*>
    Priority: 6
    CaseSensitive: true
  # C system headers
  - Regex: <.*\.h>
    Priority: 5
    CaseSensitive: true
  # Boost headers
  - Regex: boost/.*
    Priority: 4
    CaseSensitive: true
  # Message headers
  - Regex: .*_msgs/.*
    Priority: 3
    CaseSensitive: true
  - Regex: .*_srvs/.*
    Priority: 3
    CaseSensitive: true
  # Other Package headers
  - Regex: <.*>
    Priority: 2
    CaseSensitive: true
  # Local package headers
  - Regex: '".*"'
    Priority: 1
    CaseSensitive: true

参考
https://zenn.dev/masaki_wk/articles/20220911-clang-format

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to 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