clang-format

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • agoodman
    Adept
    • Jan 2011
    • 114

    clang-format

    I didn't see a thread on this so... here is the .clang-format I have been using (attached) on the borg code just to make it format similar to the rest of the code. If there are modifications I should make or if someone has already made a better one, lmk.
    Attached Files
  • backwardsEric
    Knight
    • Aug 2019
    • 527

    #2
    Builds using configure on macOS use the "-Wnewline-eof" warning flag by default and that flags many of the borg files as missing a newline at the end of the file. There's no similar messages for the rest of the Angband source code. Is specifying a newline at the end of the file something that can be done with clang-format?
    Last edited by backwardsEric; December 13, 2023, 17:20. Reason: fix typo

    Comment

    • agoodman
      Adept
      • Jan 2011
      • 114

      #3
      Originally posted by backwardsEric
      Builds using configure on macOS use the "-Wnewline-eof" warning flag by default and that flags many of the borg files as missing a newline at the end of the file. There's no similar messages for the rest of the Angband source code. Is specifying a newline at the end of the file something that can be done with clang-format?
      I think
      InsertNewlineAtEOF: true
      I will double check and add that if it isn't there and update the borg files.

      The biggest problem I have found with auto-formatting using this is that it messes up arrays in the
      static const int adj_mag_mana[STAT_RANGE] = {
      0 /* 3 */,
      10 /* 4 */,
      20 /* 5 */,
      30 /* 6 */,
      40 /* 7 */,
      50 /* 8 */,
      ...
      formatting so I have to manually exclude those when formatting the file.

      Comment

      Working...
      😀
      😂
      🥰
      😘
      🤢
      😎
      😞
      😡
      👍
      👎