MCPcopy Index your code
hub / github.com/nodejs/node / GetPreviousNonBlankLine

Function GetPreviousNonBlankLine

tools/cpplint.py:4797–4817  ·  view source on GitHub ↗

Return the most recent non-blank line and its line number. Args: clean_lines: A CleansedLines instance containing the file contents. linenum: The number of the line to check. Returns: A tuple with two elements. The first element is the contents of the last non-blan

(clean_lines, linenum)

Source from the content-addressed store, hash-verified

4795
4796
4797def GetPreviousNonBlankLine(clean_lines, linenum):
4798 """Return the most recent non-blank line and its line number.
4799
4800 Args:
4801 clean_lines: A CleansedLines instance containing the file contents.
4802 linenum: The number of the line to check.
4803
4804 Returns:
4805 A tuple with two elements. The first element is the contents of the last
4806 non-blank line before the current line, or the empty string if this is the
4807 first non-blank line. The second is the line number of that line, or -1
4808 if this is the first non-blank line.
4809 """
4810
4811 prevlinenum = linenum - 1
4812 while prevlinenum >= 0:
4813 prevline = clean_lines.elided[prevlinenum]
4814 if not IsBlankLine(prevline): # if not a blank line...
4815 return (prevline, prevlinenum)
4816 prevlinenum -= 1
4817 return ("", -1)
4818
4819
4820def CheckBraces(filename, clean_lines, linenum, error):

Callers 3

CheckBracesFunction · 0.85
CheckTrailingSemicolonFunction · 0.85
CheckStyleFunction · 0.85

Calls 1

IsBlankLineFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…