On 09/07/2017 04:17 AM, Mike Hommey wrote:
On Thu, Sep 07, 2017 at 12:47:51AM -0700, Chris Peterson wrote:
On 2017-09-06 8:06 PM, Ehsan Akhgari wrote:
The interesting points to consider is the data that Nick alluded to in
the previous discussion about the existing prevalent style.
Also, the point you up about the pragmatic aspect of the need to be able
to use automated tools in order to manage our Coding Style is right on.
As things stand, the only viable option of such a tool that I'm aware of
is clang-format, and given the standing situation with regards to what
formatting options we can make that tool support in this case, I think
the pragmatic decision is to pick *one* option here for the placement of
operators across line breaks: either at the end of long lines or in the
beginning of the next line.
The combination of the above points makes me prefer adopting the
proposal to treat all operators like && and ||.
There are only a couple hundred instances of boolean operators after a line
break in mozilla-central C++ code. I know this search is inexact, but it
shows the (small) scale of this usage compared to the proposed
before-line-break style.
https://searchfox.org/mozilla-central/search?q=%5E%5Cs%2B(%3E%7C%3E%3D%7C%3C%7C%3C%3D%7C%3D%3D%7C!%3D)%5Cs%2B(%5Cw%7C%5C()&case=true®exp=true&path=.c
Note that there seems to be about the same number of boolean operators
before a line break (if you ignore the ones from generated code)
https://searchfox.org/mozilla-central/search?q=%5Cs(%3E%7C%3E%3D%7C%3C%7C%3C%3D%7C%3D%3D%7C!%3D)%5Cs*%24&case=true®exp=true&path=.c
Not really. Searchfox caps the regex results at 1000. Local grep is
much more suitable for this kind of analysis. On local inbound I have:
$ git grep '\s(>|>=|<|<=|==|!=)\s*$' -- '*.c*' | wc -l
2794
$ git grep '^\s+(>|>=|<|<=|==|!=)\s+(\w|\()' -- '*.c*' | wc -l
419
This of course doesn't include all operators that matter here but the
trend is pretty clear.
_______________________________________________
dev-platform mailing list
dev-platform@lists.mozilla.org
https://lists.mozilla.org/listinfo/dev-platform