[Interest] 80 column enforcement under Linux

roland at logikalsolutions.com roland at logikalsolutions.com
Fri Jan 18 23:44:56 CET 2019


Thanks for the feedback gentleman.

I was unaware Artistic Style is dead. Haven't found a line length  
thing in it anyway. I am using Artistic Style for formatting because  
the default QtCreator coding style and a project level .astylerc of  
this:

# If you have astyle installed on your Linux development machine and
# you have enabled it via Beautifier plug-in then this file will control
# how the beautifier formats the code.

--style=allman
--indent=spaces=4
--add-braces
--convert-tabs
--keep-one-line-statements

along with a keyboard shortcut of <ALT><Shift><F> gets me the bulk of  
the way there. I have to manually view the ruler and fix which is fine  
since I'm merging multiple "test" projects into something usable, but,  
the "official" requirement states "an automated tool." Might see if we  
can get overrides for that.

Quoting Matthew Woehlke <mwoehlke.floss at gmail.com>:

> On 18/01/2019 13.54, Michael Jackson wrote:
>> I would think that clang-format should be able to help you out with  
>> this. It is part of the LLVM download.
>
> Ugh... clang-format...
>
> Be warned: clang-format's version of line length enforcement is *very*
> draconian. There is exactly one, and *only* one way to wrap a line (for
> a given configuration, anyway¹). If you try to wrap a line differently,
> because it improves readability... that's wrong, and clang-format will
> "fix" it for you.
>
> I can't recommend astyle, since it is basically dead, but please do
> yourself a favor and also look at uncrustify, which is active and can be
> configured to be far less rigid than clang-format while still enforcing
> a line length limit.
>
> (¹ Basically, clang-format supports "one item per line", "greedy", and
> nothing in between². You can choose between them, but only globally, not
> on a per-case basis.)
>
> (² Pedantically, it also supports "leave it alone", but only if you turn
> off line length enforcement, so that doesn't help you.)
>
> --
> Matthew


-- 
Roland Hughes, President
Logikal Solutions
(630) 205-1593

http://www.theminimumyouneedtoknow.com
http://www.infiniteexposure.net
http://www.johnsmith-book.com
http://www.logikalblog.com
http://www.interestingauthors.com/blog
http://lesedi.us




More information about the Interest mailing list