You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@trafficserver.apache.org by "zwoop (via GitHub)" <gi...@apache.org> on 2023/07/12 17:13:21 UTC

[GitHub] [trafficserver] zwoop opened a new pull request, #10002: Use cmake-format for consistent CMakeLists.txt formatting

zwoop opened a new pull request, #10002:
URL: https://github.com/apache/trafficserver/pull/10002

   This doesn't enforce this (yet), but easy to run manually with something like
   
   ```
   cmake-format -i $(find . -name CMakeLists.txt)
   ```
   
   To install cmake-format, I ran
   
   ```
   pip3 install cmake-format
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1633016114

   When a command is split across multiple lines, I prefer to put the variable or target of interest on the same line as the command:
   ```cmake
   target_compile_options(my_target
     PRIVATE
       -Wall
       -Wextra
   )
    
    This distinguishes the subject of the command, or in a variable in a `set()` command, from the rest of the arguments.
    I put usage requirement scopes on their own line:
    ```cmake
    PRIVATE
        -Wall
   ```
   instead of
   ```cmake
   PRIVATE -Wall
   ```
   I think this is easier to type and looks nicer. It's probably easier for tools to auto-indent correctly as well.
   
   I also use 2-space indents. I used 4-space indents in this repo because most of it was already 4-space indents, but Kitware seems to use 2-space indents and I picked up the habit from looking at their repo. I've personally found it nice, because CMake lines tend to get pretty long and in some cases cannot be split across multiple lines easily. This also supports the previous point.
   
   Everything else I noticed looks good to me.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] cmcfarlen commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "cmcfarlen (via GitHub)" <gi...@apache.org>.
cmcfarlen commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1633199468

   I also can't figure out how to get the first token up with the `(`. Although this does seem to happen for `set` and some others.  
   I agree with @JosiahWI about the change to the directory grouping.  That's a problem.
   
   setting `max_subgroups_hwrap: 4` makes some things better and some worse 😢 


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1633031583

   I'm interesting in what @cmcfarlen prefers. Most of the CMake is pretty consistent and I think we're generally in agreement about how to format it, but he may have some good reasons for doing things differently that I haven't considered.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1640477965

   I asked on the CMake Matrix room about formatters and the maintainer of https://github.com/Decodetalkers/neocmakelsp/ answered me. It's a full language server, so it does more than we need, and I could not get it to pick up the .editconfig file as described in their README, but I am pretty happy with the default format. Maybe @cmcfarlen would take a look at it as well.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] zwoop commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1633127320

   And I should say, I rather live with some ugliness, as long as it's consistently ugly, rather than pretty inconsistency.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] bneradt commented on a diff in pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "bneradt (via GitHub)" <gi...@apache.org>.
bneradt commented on code in PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#discussion_r1262868294


##########
.cmake-format.yaml:
##########
@@ -0,0 +1,245 @@
+_help_parse: Options affecting listfile parsing
+parse:
+  _help_additional_commands:
+    - Specify structure for custom cmake functions
+  additional_commands:
+    foo:
+      flags:
+        - BAR
+        - BAZ
+      kwargs:
+        HEADERS: "*"
+        SOURCES: "*"
+        DEPENDS: "*"
+  _help_override_spec:
+    - Override configurations per-command where available
+  override_spec: {}
+  _help_vartags:
+    - Specify variable tags.
+  vartags: []
+  _help_proptags:
+    - Specify property tags.
+  proptags: []
+_help_format: Options affecting formatting.
+format:
+  _help_disable:
+    - Disable formatting entirely, making cmake-format a no-op
+  disable: false
+  _help_line_width:
+    - How wide to allow formatted cmake files
+  line_width: 120
+  _help_tab_size:
+    - How many spaces to tab for indent
+  tab_size: 4

Review Comment:
   Let's use the default value of 2 here since that seems to be the expected default.
   
   Everything else looks fine. As usual it's not perfect, but the consistency is worth it.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1633018939

   ```cmake
   target_include_directories(
       yaml-cpp PUBLIC $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include> $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>
       PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/src>
   )
   ```
   
   Just noticed this in the changes. This is not good. This is obscuring behavior by destroying the visual separation between the two generators.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] Use cmake-format for consistent CMakeLists.txt formatting [trafficserver]

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop merged PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1640329584

   I wonder how hard it would be to roll our own formatter.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] zwoop commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1633166168

   I made one config change, which I think reduces some of the ugliness mentioned. I can't find a way to keep the first word on the line with the leading '('.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] masaori335 commented on a diff in pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "masaori335 (via GitHub)" <gi...@apache.org>.
masaori335 commented on code in PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#discussion_r1263145694


##########
iocore/dns/CMakeLists.txt:
##########
@@ -15,24 +15,19 @@
 #
 #######################
 
-
-add_library(inkdns STATIC
-    DNS.cc
-    DNSConnection.cc
-    Inline.cc
-    SplitDNS.cc
+add_library(inkdns STATIC DNS.cc DNSConnection.cc Inline.cc SplitDNS.cc)
+target_include_directories(
+    inkdns
+    PRIVATE ${CMAKE_SOURCE_DIR}/iocore/eventsystem
+            ${CMAKE_SOURCE_DIR}/iocore/dns
+            ${CMAKE_SOURCE_DIR}/iocore/io_uring
+            ${CMAKE_SOURCE_DIR}/iocore/aio
+            ${CMAKE_SOURCE_DIR}/iocore/net
+            ${CMAKE_SOURCE_DIR}/iocore/cache
+            ${CMAKE_SOURCE_DIR}/iocore/hostdb
+            ${CMAKE_SOURCE_DIR}/proxy
+            ${CMAKE_SOURCE_DIR}/proxy/http
+            ${CMAKE_SOURCE_DIR}/proxy/hdrs
+            ${CMAKE_SOURCE_DIR}/mgmt
+            ${CMAKE_SOURCE_DIR}/mgmt/utils
 )
-target_include_directories(inkdns PRIVATE
-        ${CMAKE_SOURCE_DIR}/iocore/eventsystem
-        ${CMAKE_SOURCE_DIR}/iocore/dns
-        ${CMAKE_SOURCE_DIR}/iocore/io_uring
-        ${CMAKE_SOURCE_DIR}/iocore/aio
-        ${CMAKE_SOURCE_DIR}/iocore/net
-        ${CMAKE_SOURCE_DIR}/iocore/cache
-        ${CMAKE_SOURCE_DIR}/iocore/hostdb
-        ${CMAKE_SOURCE_DIR}/proxy
-        ${CMAKE_SOURCE_DIR}/proxy/http
-        ${CMAKE_SOURCE_DIR}/proxy/hdrs
-        ${CMAKE_SOURCE_DIR}/mgmt
-        ${CMAKE_SOURCE_DIR}/mgmt/utils
-)

Review Comment:
   Does `cmake-format` have a option like `InsertNewlineAtEOF` of `clang-format`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1632935503

   We currently have a very high throughput of CMake changes. We want to make sure we enforce this in CI quickly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] zwoop commented on a diff in pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop commented on code in PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#discussion_r1264186546


##########
iocore/dns/CMakeLists.txt:
##########
@@ -15,24 +15,19 @@
 #
 #######################
 
-
-add_library(inkdns STATIC
-    DNS.cc
-    DNSConnection.cc
-    Inline.cc
-    SplitDNS.cc
+add_library(inkdns STATIC DNS.cc DNSConnection.cc Inline.cc SplitDNS.cc)
+target_include_directories(
+    inkdns
+    PRIVATE ${CMAKE_SOURCE_DIR}/iocore/eventsystem
+            ${CMAKE_SOURCE_DIR}/iocore/dns
+            ${CMAKE_SOURCE_DIR}/iocore/io_uring
+            ${CMAKE_SOURCE_DIR}/iocore/aio
+            ${CMAKE_SOURCE_DIR}/iocore/net
+            ${CMAKE_SOURCE_DIR}/iocore/cache
+            ${CMAKE_SOURCE_DIR}/iocore/hostdb
+            ${CMAKE_SOURCE_DIR}/proxy
+            ${CMAKE_SOURCE_DIR}/proxy/http
+            ${CMAKE_SOURCE_DIR}/proxy/hdrs
+            ${CMAKE_SOURCE_DIR}/mgmt
+            ${CMAKE_SOURCE_DIR}/mgmt/utils
 )
-target_include_directories(inkdns PRIVATE
-        ${CMAKE_SOURCE_DIR}/iocore/eventsystem
-        ${CMAKE_SOURCE_DIR}/iocore/dns
-        ${CMAKE_SOURCE_DIR}/iocore/io_uring
-        ${CMAKE_SOURCE_DIR}/iocore/aio
-        ${CMAKE_SOURCE_DIR}/iocore/net
-        ${CMAKE_SOURCE_DIR}/iocore/cache
-        ${CMAKE_SOURCE_DIR}/iocore/hostdb
-        ${CMAKE_SOURCE_DIR}/proxy
-        ${CMAKE_SOURCE_DIR}/proxy/http
-        ${CMAKE_SOURCE_DIR}/proxy/hdrs
-        ${CMAKE_SOURCE_DIR}/mgmt
-        ${CMAKE_SOURCE_DIR}/mgmt/utils
-)

Review Comment:
   Not that I could see :/



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] JosiahWI commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "JosiahWI (via GitHub)" <gi...@apache.org>.
JosiahWI commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1632931827

   Definitely very different from the personal style I adhere to, but it's important to have a consistent style.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] zwoop commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1632985938

   @JosiahWI If you have suggestions for changes to make to the .clang-format.yaml, please post here.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [trafficserver] zwoop commented on pull request #10002: Use cmake-format for consistent CMakeLists.txt formatting

Posted by "zwoop (via GitHub)" <gi...@apache.org>.
zwoop commented on PR #10002:
URL: https://github.com/apache/trafficserver/pull/10002#issuecomment-1633124294

   I don't know that cmake-format has options for what you are asking for, but if you can figure it out, please post.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@trafficserver.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org