r"""Trailing blank lines are superfluous.

    Okay: spam(1)
    W391: spam(1)\n

    However the last line should end with a new line (warning W292).
771214
def trailing_blank_lines(physical_line, lines, line_number, total_lines):
    
    """
    if line_number == total_lines:
        stripped_last_line = physical_line.rstrip()
        if not stripped_last_line:
            return 0, "W391 blank line at end of file"
        if stripped_last_line == physical_line:
            return len(physical_line), "W292 no newline at end of file"
297539
function(str){
    var lines = str.match(/\n/g)
      , idx = str.lastIndexOf('\n');

    if (lines) this.lineno += lines.length;
    this.column = ~idx
      ? str.length - idx
      : this.column + str.length;
  }
977395
def split_trailing_indent(line, max_indents=None):
    """"""
    indent = ""
    while (
        (max_indents is None or max_indents > 0)
        and line.endswith((openindent, closeindent))
    ) or line.rstrip() != line:
        if max_indents is not None and (line.endswith(openindent) or line.endswith(closeindent)):
            max_indents -= 1
        indent = line[-1] + indent
        line = line[:-1]
    return line, indent
1220408
private function checkLinesBetweenUses(): void
    {
        $file = $this->getFile();
        $previousUsePos = null;

        foreach ($this->uses as $usePos) {
            if ($previousUsePos === null) {
                $previousUsePos = $usePos;
                continue;
            }

            $posBeforeUse = TokenHelper::findPreviousEffective($file, $usePos - 1);
            $previousUseEndPos = TokenHelper::findNextLocal(
                $file,
                [T_SEMICOLON, T_OPEN_CURLY_BRACKET],
                $previousUsePos + 1
            );

            $realLinesBetweenUse = $this->getRealLinesBetweenUses(
                $previousUseEndPos,
                $usePos
            );

            $previousUsePos = $usePos;

            if ($realLinesBetweenUse !== self::LINES_BETWEEN_USES) {
                $errorParameters = [
                    self::MESSAGE_INCORRECT_LINES_COUNT_BETWEEN_USES,
                    $usePos,
                    self::CODE_INCORRECT_LINES_COUNT_BETWEEN_USES,
                    [
                        self::LINES_BETWEEN_USES,
                        $realLinesBetweenUse
                    ]
                ];

                if ($previousUseEndPos !== $posBeforeUse) {
                    $file->addError(...$errorParameters);
                } else {
                    $fix = $file->addFixableError(...$errorParameters);

                    if ($fix) {
                        $this->fixLinesBetweenUses($usePos, $previousUseEndPos, self::LINES_BETWEEN_USES);
                    }
                }
            }
        }
    }
983837
def split_leading_trailing_indent(line, max_indents=None):
    """"""
    leading_indent, line = split_leading_indent(line, max_indents)
    line, trailing_indent = split_trailing_indent(line, max_indents)
    return leading_indent, line, trailing_indent
1318541
def _endCodeIfNeeded(line, inCodeBlock):
        """"""
        assert isinstance(line, str)
        if inCodeBlock:
            line = '# @endcode{0}{1}'.format(linesep, line.rstrip())
            inCodeBlock = False
        return line, inCodeBlock
10150
def untokenize_without_newlines(tokens):
    """"""
    text = ''
    last_row = 0
    last_column = -1

    for t in tokens:
        token_string = t[1]
        (start_row, start_column) = t[2]
        (end_row, end_column) = t[3]

        if start_row > last_row:
            last_column = 0
        if (
            (start_column > last_column or token_string == '\n') and
            not text.endswith(' ')
        ):
            text += ' '

        if token_string != '\n':
            text += token_string

        last_row = end_row
        last_column = end_column

    return text.rstrip()
377845
def _remove_trailing_spaces(text: str) -> str:
        
        clean_text = str()

        for line in text.splitlines(True):
            # remove trailing spaces (0x20) and tabs (0x09)
            clean_text += line.rstrip("\x09\x20")

        return clean_text
706671
function trimCommitMessage(message) {
		var splitted = message.split(/\r\n|\n/);
		var iterator = 0;
		
		while(splitted.length > 0 && /^\s*$/.test(splitted[iterator])) {
			iterator++;
		}
		var maxMessageLength = 100;
		if (splitted[iterator].length > maxMessageLength) return splitted[iterator].substring(0,maxMessageLength);
		return splitted[iterator];
	}
580024
def _clean_line(self, l):
        ''''''

        new_line = self._sub_ip(l)                  # IP substitution
        new_line = self._sub_hostname(new_line)     # Hostname substitution
        new_line = self._sub_keywords(new_line)     # Keyword Substitution

        return new_line
706868
function semanticShorten(line, maxLength) {
  var parts = line.split(/(\s|-)/g),
      part,
      shortenedParts = [],
      length = 0;

  // try to shorten via spaces + hyphens
  if (parts.length > 1) {
    while ((part = parts.shift())) {
      if (part.length + length < maxLength) {
        shortenedParts.push(part);
        length += part.length;
      } else {
        // remove previous part, too if hyphen does not fit anymore
        if (part === '-') {
          shortenedParts.pop();
        }

        break;
      }
    }
  }

  return shortenedParts.join('');
}
24516
function(str, indent) {
			var lines = str.split("\n");
			for (var i=0; i<lines.length; i++)
				lines[i] = indent + lines[i];
			return lines.join("\n");
		}
1247180
function (node, lastLineIndent) {
    var endIndent = getNodeIndent(node, true);
    if (endIndent !== lastLineIndent) {
      context.report(
        node,
        { line: node.loc.end.line, column: node.loc.end.column },
        MESSAGE,
        { gotten: endIndent, needed: lastLineIndent }
      );
    }
  }
1374357
private String trim(String line) {
        char[] chars = line.toCharArray();
        int len = chars.length;

        while (len > 0) {
            if (!Character.isWhitespace(chars[len - 1])) {
                break;
            }
            len--;
        }

        return line.substring(0, len);
    }
77515
private static String cleanLine(String line) {
        return line.replace("/**", EMPTY_STRING).replace("/*", EMPTY_STRING)
                .replace("*", EMPTY_STRING).replace("#", EMPTY_STRING)
                .replace("/", EMPTY_STRING).replace("\\t", EMPTY_STRING)
                .replace("\\n", EMPTY_STRING).trim();
    }
741796
function trimTrailing(text, postfix) {
        if (text && postfix) {
            if (_.endsWith(text, postfix)) {
                return text.substring(0, text.length - postfix.length);
            }
        }
        return text;
    }
1000927
def fix_e112(self, result):
        """"""
        line_index = result['line'] - 1
        target = self.source[line_index]

        if not target.lstrip().startswith('#'):
            # Don't screw with invalid syntax.
            return []

        self.source[line_index] = self.indent_word + target