Simplify calls to whitespace() and use it in more places.
Needs RevisionPublic

Authored by tcanabrava on Jan 23 2020, 4:22 PM.

Details

Reviewers
dfaure
ervin
Summary

whitespace now returns a textStream so we don't need to stream() << whitespace()
Use whitespace where we had stream() << " followed by 4 spaces

There are plenty of manual space manipulation on the code that I plan to
get rid of, but that will have to wait as it will break every single
testcase.

Test Plan

Run unittests

Diff Detail

Repository
R237 KConfig
Branch
simplify_whitespace
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 21588
Build 21606: arc lint + arc unit
tcanabrava created this revision.Jan 23 2020, 4:22 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptJan 23 2020, 4:22 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
tcanabrava requested review of this revision.Jan 23 2020, 4:22 PM
ervin added a comment.Jan 28 2020, 5:44 PM

I'm not sure I like whitespace() returning the stream and then being used. In effect it leads to hiding the stream object making the code more terse indeed but less obvious I think.
Maybe it's a question of personal taste, @dfaure any opinion?

dfaure requested changes to this revision.Feb 2 2020, 10:35 AM

I don't like it either. It doesn't "read" well.
Looking at cout or qDebug it's much more common to [the usual stream] << [some modifier] << some more stuff.

Maybe it can be solved with naming though.
indentedStream() << ...
?

This revision now requires changes to proceed.Feb 2 2020, 10:35 AM

I like indentedStream.

ervin added a comment.Feb 12 2020, 1:15 PM

I don't like it either. It doesn't "read" well.
Looking at cout or qDebug it's much more common to [the usual stream] << [some modifier] << some more stuff.

Yep, that's what made me jump in fact, it feels unusual. :-)

Maybe it can be solved with naming though.
indentedStream() << ...
?

Not bad, it's a good compromise.