clang-format produced code that (choose all that apply):
- Doesn't match Chromium style
- Doesn't match blink style
x Riles my finely honed stylistic dander
- No sane human would ever choose
Here's the code before formatting:
const std::string patterns[] = {
// Queries with path "/search" need to have the query parameter in either
// the url parameter or the hash fragment.
"%s://www.google.com/search?%s=something",
"%s://www.google.com/search#%s=something",
"%s://www.google.com/search?name=bob&%s=something",
"%s://www.google.com/search?name=bob#%s=something",
"%s://www.google.com/search?name=bob#age=24&%s=thng",
"%s://www.google.co.uk/search?%s=something",
// It's actually valid for both to have the query parameter.
"%s://www.google.com/search?%s=something#q=other",
// Queries with path "/webhp", "/" or "" need to have the query parameter
// in the hash fragment.
"%s://www.google.com/webhp#%s=something",
"%s://www.google.com/webhp#name=bob&%s=something",
"%s://www.google.com/webhp?name=bob#%s=something",
"%s://www.google.com/webhp?name=bob#age=24&%s=thing",
"%s://www.google.com/#%s=something",
"%s://www.google.com/#name=bob&%s=something",
"%s://www.google.com/?name=bob#%s=something",
"%s://www.google.com/?name=bob#age=24&%s=something",
"%s://www.google.com#%s=something",
"%s://www.google.com#name=bob&%s=something",
"%s://www.google.com?name=bob#%s=something",
"%s://www.google.com?name=bob#age=24&%s=something",
// Google subdomain queries.
"%s://ipv4.google.com/search?%s=something",
"%s://ipv4.google.com#name=bob&%s=something",
"%s://ipv6.google.com?name=bob#%s=something",
"%s://ipv6.google.com?name=bob#age=24&%s=something",
// Trailing dots in the hosts.
"%s://www.google.com./#%s=something",
"%s://www.google.de./#%s=something",
"%s://ipv4.google.com./#%s=something",
"%s://ipv6.google.com./#%s=something",
};
Here's the code after formatting:
const std::string patterns[] = {
// Queries with path "/search" need to have the query parameter in either
// the url parameter or the hash fragment.
"%s://www.google.com/search?%s=something",
"%s://www.google.com/search#%s=something",
"%s://www.google.com/search?name=bob&%s=something",
"%s://www.google.com/search?name=bob#%s=something",
"%s://www.google.com/search?name=bob#age=24&%s=thng",
"%s://www.google.co.uk/search?%s=something",
// It's actually valid for both to have the query parameter.
"%s://www.google.com/search?%s=something#q=other",
// Queries with path "/webhp", "/" or "" need to have the query parameter
// in the hash fragment.
"%s://www.google.com/webhp#%s=something",
"%s://www.google.com/webhp#name=bob&%s=something",
"%s://www.google.com/webhp?name=bob#%s=something",
"%s://www.google.com/webhp?name=bob#age=24&%s=thing",
"%s://www.google.com/#%s=something",
"%s://www.google.com/#name=bob&%s=something",
"%s://www.google.com/?name=bob#%s=something",
"%s://www.google.com/?name=bob#age=24&%s=something",
"%s://www.google.com#%s=something",
"%s://www.google.com#name=bob&%s=something",
"%s://www.google.com?name=bob#%s=something",
"%s://www.google.com?name=bob#age=24&%s=something",
// Google subdomain queries.
"%s://ipv4.google.com/search?%s=something",
"%s://ipv4.google.com#name=bob&%s=something",
"%s://ipv6.google.com?name=bob#%s=something",
"%s://ipv6.google.com?name=bob#age=24&%s=something",
// Trailing dots in the hosts.
"%s://www.google.com./#%s=something", "%s://www.google.de./#%s=something",
"%s://ipv4.google.com./#%s=something",
"%s://ipv6.google.com./#%s=something",
};
Here's how it ought to look:
I think the before case is better. I understand that we're unifying {} and () initializer syntax, but I would have expected the trailing comma to also mean "one per line". It does for JS clang formatting, at least within google3.
Code review link for full files/context:
https://codereview.chromium.org/2861183002/diff/100001/components/google/core/browser/google_util_unittest.cc
(Related to bug 721496 , where I forgot to call out this additional point of frustration.)
Comment 1 by dtapu...@chromium.org
, Oct 26 2017