Filetemplate generation: avoid trailing empty line in license header
ClosedPublic

Authored by kossebau on Aug 1 2017, 9:16 PM.

Details

Summary

The linebreak behind the last line in a license template results
in another, empty line being added to the generated license header.
Which is assumed to be never intended, but only a result of
additional line formatting in the license template.

Diff Detail

Repository
R33 KDevPlatform
Branch
fixemptylicenselineingeneratedheader
Lint
No Linters Available
Unit
No Unit Test Coverage
kossebau created this revision.Aug 1 2017, 9:16 PM
Restricted Application added a subscriber: kdevelop-devel. · View Herald TranscriptAug 1 2017, 9:16 PM

Not really sure about this one. Alternative approaches could be:
a) completely trim the license text from any leading and trailing empty lines, not just a last linebreak
b) fix the existing license templates to not end with a linebreak

What do you think?

kfunk added a subscriber: kfunk.Aug 2 2017, 7:32 AM

Not really sure about this one. Alternative approaches could be:
a) completely trim the license text from any leading and trailing empty lines, not just a last linebreak
b) fix the existing license templates to not end with a linebreak

What do you think?

I just fixing up the license text after having loaded them is fine. Wouldn't touch the license files, as otherwise Git complains about files not having a new line at the EOF.

plugins/filetemplates/licensepage.cpp
258

I think the additional newline should be rather stripped inside LicensePagePrivate::readLicense, not here.

I just tested this:

  • If I manually enter text, everything works just fine.
  • If I use any of the presets, then indeed there's an additional newline added.

-> We just need to fix the contents of the presets after they were loaded from disk.

kossebau updated this revision to Diff 17561.Aug 2 2017, 11:55 AM

remove trailing linebreak on loading already

kfunk accepted this revision.Aug 2 2017, 12:37 PM
This revision is now accepted and ready to land.Aug 2 2017, 12:37 PM
This revision was automatically updated to reflect the committed changes.
kossebau marked an inline comment as done.