[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Tlf-devel] code indenting?
Re: [Tlf-devel] code indenting?
Thu, 25 Jan 2018 16:25:32 +0100
Am Thu, 25 Jan 2018 14:12:53 +0100
schrieb Ervin Hegedüs <address@hidden>:
> Hi Nate,
> On Thu, Jan 25, 2018 at 06:21:56AM -0600, Nate Bargmann wrote:
> > * On 2018 24 Jan 23:34 -0600, Thomas Beierlein wrote:
> > I recommend astyle only for the fact that it can do some things GNU
> > indent does not.
I can confirm this. I remember doing some comparison of the different C
formatting tools some time ago. Indent was not easy to use and had some
> > It works well for getting the variety of coding
> > styles found in the Hamlib code base somewhat close to what I
> > want. I still go through and hand massage the files a bit more.
I had a chance to do some tests during the day with 'indent' and
'astyle' (with the hamlib .astylerc as a starter). I must say that it
was much more easy to find a formatting style quite near to the actual
coding with astyle. Please find the actual formatting options appended
below for your own tests.
> what's the "astyle"? Is it an another formatter, like GNU indent?
Yes Ervin, 'astyle' is a formatting tool like 'indent' which is also
available on all linux distros I have access to. For documentation see
> > > - I further had a look into the Travis CI which integrates neatly
> > > with the github working flow. Maybe we should use it to do common
> > > checks on the code automatically.
> > I'd not heard of this. More info, Tom?
> (I don't want to reply instead of Tom - I just near to my machine :))
> You can set up in your any repository, that when a PR arrives, a
> hook will start a build flow (and/or a test list) before
> you merge the code.
Nothing more needs to be said about that. Thanks Ervin.
Please find my actual .astylerc config copied in below. It is a work in
progress but can do as a starting point.
Copy it to a file with name '.astylerc' and test with
$ astyle --option=.astylerc < infile > outfile
I used 'meld' for comparison of old and new. There are mostly
whitespace changes. You can filter out these differences in the meld
preferences box and leave only the main structural ones.
73, de Tom
P.S. .astylrc content below
# astylerc--custom options for astyle
# K&R style formatting/indenting with some tweaks.
# Indent with a width of 4 spaces.
# Pad empty lines around header blocks (e.g. 'if', 'for', 'while'...).
# Remove extra space padding around parenthesis on the inside and outside.
# Insert space padding around operators.
# Insert space padding after paren headers only (e.g. 'if', 'for', 'while'...).
# Attach a pointer operator (*) to name (name) and reference operator (&)
# to type (type).
# Add brackets to unbracketed one line conditional statements
# (e.g. 'if', 'for', 'while'...).
# Don't break one-line blocks.
# Don't break complex statements and multiple statements residing on a single
# Breaks else from immediately preceding closing braces
# Converts tabs into spaces in the non-indentation part of the line.
# try to shorten long lines to 80 characters
# Preserve the file date and time
"Do what is needful!"
Ursula LeGuin: Earthsea