On 2017/02/18 7:28, Bobby Holley wrote:
> On Fri, Feb 17, 2017 at 2:18 PM, <
gsqu...@mozilla.com> wrote:
>
>> Hi again Nick,
>>
>> Someone made me realize that I didn't fully read your message, sorry for
>> that.
>>
>> I now see that as well as &&/||, you have grepped for other operators, and
>> shown that the overwhelming usage is to put all of them at the end of lines!
>>
>> In light of this, and from what others here&elsewhere have discussed, I'm
>> now thinking that we probably should indeed just update our coding style
>> with whatever is used the most out there, and model our "Official
>> Formatter" on it.
>>
>>
>> Another thought, if technically possible:
>> If our main repository is going to always be under the control of some
>> official clang-format style, it should be possible for anybody to pull the
>> repository, and use a different formatter locally with their favorite
>> style. And when pushing, their modified code could be automatically
>> reformatted with the official formatter -- Everybody feels good when
>> programming! :-)
>>
>
> Please no. That would make reviewing a nightmare.
>
I think the idea is to produce the patch after (virtually) reformatting
the local tree into the officially adopted format and create the patch
against the tree.
The reviewers will get into
checkout
Central repo
-> local repo in the official format
check out a file or files to be modified.
Use a clang-format or whatever by passing options to it
to produce one's preferred format and check it (them) into
a working repo.
-> local repo in the preferred format: local mods take place
We work on the files in one's preferred format.
checkin/creating a patch
local repo in the preferred format: local mods take place
Locally use clang-format or whatever to mutate the changed
file into official format and check into the local repo in the
official format.
<--
local repo in the official format
Either create a patch (in the official format source)
or check into the central repo.
<--
Central repo
Point 1:
I think creating a wrapper for conversion between the two local repos
as above should not be that difficult.
Point 2:
I prefer all the operators including "&&" and "||"
at the beginning since such a format makes the tree-like structure of
multi-line easier to understand and edit, too.
Adding a condition or removing a condition is much easier in this form.
I forgot where the rational was explained well. Superficially it is
covered in GNU coding starnds:
https://www.gnu.org/prep/standards/html_node/Formatting.html
Point 3: Having a tool that does such conversion AND having an editor
support such formating style is very important (In my case, it is Emacs.)
Point 4: Have no fear. Such conversion tools have existed at least for
C, Fortran, Cobol and other languages
and been used extensively.
For example, more than a dozen years ago,
in the days of version 2.1.1xx, the whole SCSI subsystem source tree of
linux kernel were converted using "indent" program.
The only change of SCSI subsystem in that revision was formating change.
This was to untangle the spaghetti code of SCSI subsystem.
Point 5: We should set up a "Flag Day" to convert the source tree into
the official format THAT IS SUPPORTED by the mechanical
converter/formater, and change the source code in one sweep.
For example, the data can be 6 months from now. August 18, 2017.
(Such a flag day / intention was announced for SCSI subsystem format
change of linux kernel, and the "Flag Day" moniker was used when Multics
changed its internal character code from what I read in the glossary
file which later became Hacker's Dictionary.)
Mechanical conversion/formating is nice: we can do this locally before
producing an official patch, and there will be no disagreements among
the reviewers :-)
expressions
>
dev-pl...@lists.mozilla.org
>
https://lists.mozilla.org/listinfo/dev-platform
>
>