MCPcopy Create free account
hub / github.com/BVLC/caffe / CheckForNewlineAtEOF

Function CheckForNewlineAtEOF

scripts/cpp_lint.py:1512–1527  ·  view source on GitHub ↗

Logs an error if there is no newline char at the end of the file. Args: filename: The name of the current file. lines: An array of strings, each representing a line of the file. error: The function to call with any errors found.

(filename, lines, error)

Source from the content-addressed store, hash-verified

1510
1511
1512def CheckForNewlineAtEOF(filename, lines, error):
1513 """Logs an error if there is no newline char at the end of the file.
1514
1515 Args:
1516 filename: The name of the current file.
1517 lines: An array of strings, each representing a line of the file.
1518 error: The function to call with any errors found.
1519 """
1520
1521 # The array lines() was created by adding two newlines to the
1522 # original file (go figure), then splitting on \n.
1523 # To verify that the file ends in \n, we just have to make sure the
1524 # last-but-two element of lines() exists and is empty.
1525 if len(lines) < 3 or lines[-2]:
1526 error(filename, len(lines) - 2, 'whitespace/ending_newline', 5,
1527 'Could not find a newline character at the end of the file.')
1528
1529
1530def CheckForMultilineCommentsAndStrings(filename, clean_lines, linenum, error):

Callers 1

ProcessFileDataFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected