Reformat source code in kdelibs style
AbandonedPublic

Authored by umanovskis on Sep 25 2019, 12:12 PM.

Details

Reviewers
cfeck
teran
Group Reviewers
KDE Applications
Summary

Formatted by the uncrustify-kf5 script

Diff Detail

Lint
Lint Skipped
Unit
Unit Tests Skipped
umanovskis created this revision.Sep 25 2019, 12:12 PM
Restricted Application added a subscriber: kde-utils-devel. · View Herald TranscriptSep 25 2019, 12:12 PM
umanovskis requested review of this revision.Sep 25 2019, 12:12 PM

I wanted to make some minor changes like removing the QT foreach from KCalc, but then it seemed prudent to first reformat the source according to KDE style. The vast majority of this diff consists of moved opening braces, and tabs replaced by spaces.

cfeck added a subscriber: cfeck.

What I usually do is to copy the style I find, but I wouldn't object reformatting for consistency.

The status quo is 'uncrustify-kf5' from https://cgit.kde.org/kde-dev-scripts.git/tree/ but I don't know if it will give a different result. Could you try this?

Yeah, I also started by copying the style, but realized a reformat might be acceptable before I do more.

The uncrustify script should perhaps be mentioned in the docs somewhere. I used astyle because I found a reference here: https://community.kde.org/Policies/Kdelibs_Coding_Style. Uncrustify produces a slightly different result, mostly regarding long lines it seems. Updating the diff to uncrustify version.

umanovskis updated this revision to Diff 66855.Sep 25 2019, 8:05 PM
umanovskis edited the summary of this revision. (Show Details)

Changed to uncrustify

I feared that it would result in many more changes, because KCalc code is 20+ years old, and maintainers didn't have guidelines for coding style back then.

We usually do not fix the coding style on old code because it makes it harder to see who contributed which changes ("git blame"). Style conventions make more sense for new code, or when the git history is rewritten anyway (e.g. for the KF5 split).

I don't know if Evan still has time to review changes; adding more reviewers to check if anyone objects.

kcalc_core.cpp
175–189

You might want to revert this part manually. The new table is much harder to read.

On the git blame point, I've found git hyper-blame to be very useful for exactly this case: https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/git-hyper-blame.html

umanovskis updated this revision to Diff 66868.Sep 26 2019, 7:33 AM

Fixed overzealous formatting

aacid added a subscriber: aacid.Sep 26 2019, 6:04 PM

Unless there's going to be a git hook, a CI job or something similar making sure we follow this style i don't see the point

umanovskis abandoned this revision.Oct 3 2019, 7:54 AM

There seems to be no consensus that that such reformats of old code are needed. Closing.