--
--
Chromium Developers mailing list: chromi...@chromium.org
View archives, change email options, or unsubscribe:
http://groups.google.com/a/chromium.org/group/chromium-dev
I'm working in base/. If this is to be the way it is... Why even make it a failure case? Just do the format in the background during upload or commit or whenever. Automated tools should be automated.
It's not that the auto-format is illegible. It's just not ideal in all cases. Couldn't this just be a warning that developers can choose to override if they feel it's worth it? The reminder to run the tool should be sufficient. I'd like to think that we're all sufficiently talented that, when presented with a possibly better option, we can pick & choose between styles to produce easily readable code.
On Tue, Nov 15, 2016 at 4:33 PM 'Brian White' via Chromium-dev <chromi...@chromium.org> wrote:I'm working in base/. If this is to be the way it is... Why even make it a failure case? Just do the format in the background during upload or commit or whenever. Automated tools should be automated.Presubmit checks aren't allowed to perform mutations (e.g., the check that says there's whitespace at the end of a line could easily just remove the whitespace). I don't recall the precise reasoning for this restriction offhand.
But if you format your code carefully and then I come by and change all your parameter types as part of a refactoring and run "git cl format" then your effort was wasted, and this happens more often than you'd think.
- complex constants: Though mostly in unit-tests, complex structure constants can get mangled in ways that make them more difficult to understand and maintain.
On Tue, Nov 15, 2016 at 8:44 AM, 'Brian White' via Chromium-dev <chromi...@chromium.org> wrote:
- complex constants: Though mostly in unit-tests, complex structure constants can get mangled in ways that make them more difficult to understand and maintain.
This has been discussed before(https://groups.google.com/a/chromium.org/forum/#!topic/chromium-dev/H8tYKcetScU,https://groups.google,.com/a/chromium.org/forum/#!topic/chromium-dev/BPXUZCcn9hU) but for this situation, would it make sense to use// clang-format offto disable cl format for a block of code?
I'm not going to wade into the discussion about the general case case (or for related code blocks specifically), but for laying out constants in unit tests for readability, it seems perfectly reasonable. It's used fairly frequently in gpu, net, WebKit, v8 -- mostly for tests -- and doesn't seem be abused.
But if you format your code carefully and then I come by and change all your parameter types as part of a refactoring and run "git cl format" then your effort was wasted, and this happens more often than you'd think.You know... I'm willing to trust you to make an informed decision. If you decided to change the formatting on parts of code to the auto-formatted version even if you haven't touched it, then okay. Presumably you have your reasons and I'm willing to give you freedom to make those choices.