#3841 - Review single-line templates

Identifier #3841
Issue type Feature request or suggestion
Title Review single-line templates
Status Completed
Tags

Roadmap: v11 (custom)

Type: Standards compliance (custom)

Handling member Chris Graham
Addon core
Description The code strips the trailing line from a file containing a single line...

// Strip off trailing final lines from single lines templates. Editors often put these in, and it causes annoying "visible space" issues
if ((substr($template_contents, -1, 1) === "\n") && (substr_count($template_contents, "\n") === 1)) {
$template_contents = substr($template_contents, 0, strlen($template_contents) - 1);
}

Yet the testCorrectLineTerminationAndLineFormat test is defining exceptions for files which do not have to have any line breaks, which contradicts it.

The original rule in our code is fine, and the test exceptions should be removed, with the trailing line added to those templates. That makes us consistent with the common coding standard of always having a trailing line break on any text file.
Steps to reproduce

Funded? No
The system will post a comment when this issue is modified (e.g., status changes). To be notified of this, click "Enable comment notifications".

Rating

Unrated