Limit number of columns to 160#1491
Conversation
|
It looks like we're gonna need to fix all the instances where the columns are long or limit it from CI being the cause of failing. But I'm all for the idea! |
|
... and it seems, I'm using a different clang-format version (21.1.0) than the CI. Is version to use specified, somewhere? |
|
clang-format version is listed here. Not sure if that's up-to-date though. |
|
Looking at the numerous changes: Increasing the column limit might make sense, but some of the changes make code harder to read. Not sure if this is something we want to apply across the board to all samples. |
You mean, even more than 160 columns?
Could you point me at some of those places? Maybe with some additional clang-format settings, it looks better, again.
I think, it should either be done for the complete repository, or not at all. |
ca0d397 to
3eb0a5d
Compare
|
Well, in fact it's clang-format 15.0.6, that is used. And for some unknown reasons, it required a few manual adjustments. But I definitely won't crank up the copyright of all those formatted files. |
06a2b6e to
5ce473a
Compare
4414079 to
13ddd1b
Compare
| "Specify the folder containing the sample data folders.", | ||
| {vkb::Hook::OnAppStart}, | ||
| {}, | ||
| DataPathTags("Data Path Override", "Specify the folder containing the sample data folders.", {vkb::Hook::OnAppStart}, {}, |
There was a problem hiding this comment.
I'm not really sure if this improves readability. I actually prefer the way it was written before this change.
There was a problem hiding this comment.
Any way to fix this? There are several spots that have had their wrapping changed in a way that at least IMO hurts code readabilit.
There was a problem hiding this comment.
With BinPackParameters: false, that looks better again.
There was a problem hiding this comment.
I think the original was easier to read too. When we enter the realm of automatic line wrapping we've gone wrong somewhere. I'd be tempted to be much more conservative in terms of line width as seeing 2 versions side-by-side is often handy.
There was a problem hiding this comment.
I think the original was easier to read too.
Do you refer to the original of this specific code part? I think, they're pretty close, now.
Or do you have other part is mind? If so, could you hint me to some of them? Maybe I can improve the readability there as well.
When we enter the realm of automatic line wrapping we've gone wrong somewhere.
I don't understand what you mean with that.
I'd be tempted to be much more conservative in terms of line width as seeing 2 versions side-by-side is often handy.
Do I read that like "It would be better to reduce the column limit to, say, 120"?
There was a problem hiding this comment.
I was referring to this specific bit.
In general when line ends are added by hand or by a code formatting tool, the code is easier to read, compared to auto-wrapping done by the viewer or horizontal scrolling to see the rest of it.
I think 120 is about right. Less than this will likely result in a massive change to the existing codebase, more will be hard to work with on a laptop screen.
There was a problem hiding this comment.
I was referring to this specific bit.
ok... and have you seen it with the latest adjustment from last week? Do you think, it's ok that way?
I think 120 is about right.
If there's more than just your request, I can easily cut column length down to 120.
13ddd1b to
68a2891
Compare
| @@ -1,4 +1,4 @@ | |||
| /* Copyright (c) 2020-2025, Arm Limited and Contributors | |||
| /* Copyright (c) 2020-2026, Arm Limited and Contributors | |||
| * Copyright (c) 2025, NVIDIA CORPORATION. All rights reserved. | |||
There was a problem hiding this comment.
Apparently, neither the copyright.py fixes such Copyright strings, nor the copyright check of the CI catches them?
0fee7e7 to
03bb966
Compare
|
Well, no matter what clang-format version (15.0.x, 0 <= x <= 7 ), win64, I tried, there are four files that needs some manual adjustments to keep the format check happy. |
03bb966 to
4ff3de1
Compare
51bc762 to
5d4c8f5
Compare
tomek-brcm
left a comment
There was a problem hiding this comment.
The updated pull request reads easier than the old one. I think 180 columns is too much, especially for a side-by-side diff I'm looking at right now. I don't want to impose my personal preferences on anybody here, but I'd give 120 columns a try
| VK_DYNAMIC_STATE_VIEWPORT, | ||
| VK_DYNAMIC_STATE_SCISSOR, | ||
| VK_DYNAMIC_STATE_LINE_WIDTH, | ||
| VK_DYNAMIC_STATE_DEPTH_BIAS, | ||
| VK_DYNAMIC_STATE_BLEND_CONSTANTS, | ||
| VK_DYNAMIC_STATE_DEPTH_BOUNDS, | ||
| VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK, | ||
| VK_DYNAMIC_STATE_STENCIL_WRITE_MASK, | ||
| VK_DYNAMIC_STATE_VIEWPORT, VK_DYNAMIC_STATE_SCISSOR, VK_DYNAMIC_STATE_LINE_WIDTH, VK_DYNAMIC_STATE_DEPTH_BIAS, | ||
| VK_DYNAMIC_STATE_BLEND_CONSTANTS, VK_DYNAMIC_STATE_DEPTH_BOUNDS, VK_DYNAMIC_STATE_STENCIL_COMPARE_MASK, VK_DYNAMIC_STATE_STENCIL_WRITE_MASK, | ||
| VK_DYNAMIC_STATE_STENCIL_REFERENCE, |
There was a problem hiding this comment.
nit: this was a bit more future-proof, it's easier to see additions and deletions with one state per line.
There was a problem hiding this comment.
Added BinPackArguments: false to resolve that.
a7753e2 to
c86a291
Compare
|
I can't get what difference there is between the clang-format I'm using and the clang-format of the CI. Otherwise, I'm essentially out on this PR and would have to just close it. |
|
https://github.com/KhronosGroup/Vulkan-Samples/actions/runs/25072289035/artifacts/6692580894 <-- I setup CI to upload a diff of what it found. Also, see if the script helps: scripts/clang-format.py I'll take a real look when I get a chance and try to help. |
c86a291 to
6a2fc29
Compare
Well, that python script changes a lot of files. But the CI is still failing.
Sure. But how would I get what has to be changed out of that blob of characters? |
Description
Every now and then, I'm surprised about the length of some code lines. I would suggest to limit that to, say, 160.
The only manual change in this PR is in
.clang-format, settingColumnLimit : 160. Then all *.cpp and *.h files are formatted accordingly.In addition to the column limit I changed the following option:
BinPackArguments: falseBinPackParameters: falseBuild tested on Win11 with VS2022. Run tested on Win11 with NVidia GPU.
General Checklist:
Please ensure the following points are checked:
Note: The Samples CI runs a number of checks including:
If this PR contains framework changes:
batchcommand line argument to make sure all samples still work properlySample Checklist
If your PR contains a new or modified sample, these further checks must be carried out in addition to the General Checklist: