Issue 5862: Prefer astyle 3.1 and update clang-format options (issue 551640043 by nine.fierce.ballads@gmail.com)

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 5862: Prefer astyle 3.1 and update clang-format options (issue 551640043 by nine.fierce.ballads@gmail.com)

nine.fierce.ballads
Reviewers: ,

Message:
It's worth emphasizing this: even with these improvements to the
clang-format configuration, those who use clang-format will introduce a
truckload of differences from the traditional indentation.

Description:
https://sourceforge.net/p/testlilyissues/issues/5862/

Prefer astyle 3.1 and update clang-format options

Change the preferred version of astyle from 2.04 to 3.1.

In a separate commit, add a few clang-format options to reduce
(slightly) the extent of changes that a subsequent fixcc.py makes.

Test procedure:
1. clang-format everything (version 9.0.0)
2. git commit
3. fixcc.py everything (astyle version 3.1)
4. git diff | wc -l

BASELINE                                          LINES
master@786c3669ff08804465a89013d349fc745fd783c9   19702

BENEFICIAL OPTIONS (TESTED INDIVIDUALLY)          LINES
ConstructorInitializerIndentWidth: 2              19062
ContinuationIndentWidth: 2                        15018
SpaceAfterCStyleCast: true                        19540
[Tested together]                                 14171

OTHER OPTIONS (TESTED INDIVIDUALLY)               LINES
AlignEscapedNewlines: Left                        19702
AlignOperands: false                              20760
AllowShortFunctionsOnASingleLine: InlineOnly      19708
AlwaysBreakTemplateDeclarations: MultiLine        19702
BinPackArguments: false                           21588
BinPackParameters: false                          20557
BreakBeforeTernaryOperators: true                 19702
BreakConstructorInitializers: BeforeColon         19702
BreakInheritanceList: BeforeColon                 19702
ColumnLimit: 80                                   19702
SortIncludes: false                               19702
SpaceAfterTemplateKeyword: false                  19702

Please review this at https://codereview.appspot.com/551640043/

Affected files (+4, -1 lines):
  M .clang-format
  M scripts/auxiliar/fixcc.py


Index: .clang-format
diff --git a/.clang-format b/.clang-format
index db078d01eacd53ae8c1da39186048641d12be7bf..126312d446f4dfbba9e2b162ac08572b60914324 100644
--- a/.clang-format
+++ b/.clang-format
@@ -7,6 +7,9 @@ Language:        Cpp
 AlwaysBreakAfterReturnType: TopLevelDefinitions
 BreakBeforeBinaryOperators: All
 BreakBeforeBraces: GNU
+ConstructorInitializerIndentWidth: 2
+ContinuationIndentWidth: 2
+SpaceAfterCStyleCast: true
 SpaceBeforeParens: Always
 ReflowComments: false
 ...
Index: scripts/auxiliar/fixcc.py
diff --git a/scripts/auxiliar/fixcc.py b/scripts/auxiliar/fixcc.py
index abb5272bc921e8ba496005556f5028272b312935..0c4324234e079b750e9fba07fa92cb05ffe3001d 100755
--- a/scripts/auxiliar/fixcc.py
+++ b/scripts/auxiliar/fixcc.py
@@ -38,7 +38,7 @@ GLOBAL_CXX = 'GC++'
 CXX = 'C++'
 verbose_p = 0
 indent_p = 1
-PREFERRED_ASTYLE_VERSION = "Artistic Style Version 2.04"
+PREFERRED_ASTYLE_VERSION = "Artistic Style Version 3.1"
 
 
 rules = {



Reply | Threaded
Open this post in threaded view
|

Re: Issue 5862: Prefer astyle 3.1 and update clang-format options (issue 551640043 by nine.fierce.ballads@gmail.com)

David Kastrup
On 2020/03/26 01:25:57, Dan Eble wrote:
> It's worth emphasizing this: even with these improvements to the
clang-format
> configuration, those who use clang-format will introduce a truckload
of
> differences from the traditional indentation.

Our own fixcc script introduces some modifications to naked Astyle if I
remember correctly.  Is there some reasonable hope that we could boil
down a "common denominator" style where alternately applying clang
formatting and fixcc would end up with a fixed end result rather than
some cycle?  Of course, that state would trivially be reached by one
style doing nothing, or the styles focusing on different problems, but
that would not be useful: we'd want to end up with either style doing as
complete of a job as possible so that people using either will commit
stuff that is mostly fine.

https://codereview.appspot.com/551640043/

Reply | Threaded
Open this post in threaded view
|

Re: Issue 5862: Prefer astyle 3.1 and update clang-format options (issue 551640043 by nine.fierce.ballads@gmail.com)

nine.fierce.ballads
In reply to this post by nine.fierce.ballads
On 2020/03/26 11:35:11, dak wrote:
> On 2020/03/26 01:25:57, Dan Eble wrote:
> > It's worth emphasizing this: even with these improvements to the
clang-format
> > configuration, those who use clang-format will introduce a truckload
of
> > differences from the traditional indentation.
...
> correctly.  Is there some reasonable hope that we could boil down a
"common
> denominator" style where alternately applying clang formatting and
fixcc would
> end up with a fixed end result rather than some cycle?

I have not familiarized myself with the options of astyle, but at
present, I'm not optimistic.

Still, as I worked on this change, I noticed a couple of common and
simple things that could take another bite out of the differences:

1. space or no space after the "operator" keyword
2. space or no space after "template" in "template<class T>"


https://codereview.appspot.com/551640043/