Checks if the set file contains any CRLF line endings.

@link http://stackoverflow.com/a/3570574
349011
public function review(ReporterInterface $reporter, ReviewableInterface $file)
    {
        $cmd = sprintf('file %s | grep --fixed-strings --quiet "CRLF"', $file->getFullPath());

        $process = $this->getProcess($cmd);
        $process->run();

        if ($process->isSuccessful()) {
            $message = 'File contains CRLF line endings';
            $reporter->error($message, $this, $file);
        }
    }
1047368
private function checkLinesAfterLastContent($closePointer, $lastPointer)
    {
        $lines = TokenHelper::getContent($this->phpcsFile, $lastPointer + 1, $closePointer);
        $linesCount = $this->countLines($lines);

        if ($linesCount === 0) {
            return;
        }

        $this->phpcsFile->addError(
            \sprintf('No lines allowed after last content, found %d.', $linesCount),
            $lastPointer,
            'LinesAfterLastContent'
        );
    }
1219464
public function isRTL()
	{
		$RandALCat	= file( __DIR__.'/StringRandALCat.txt', FILE_IGNORE_NEW_LINES );
		$codePoints	= unpack( 'V*', iconv( 'UTF-8', 'UTF-32LE', $this->string ) );
		foreach( $codePoints as $codePoint )
		{
			$hexCode	= strtoupper( str_pad( dechex( $codePoint ), 6, '0', STR_PAD_LEFT ) );
			if( array_search( $hexCode, $RandALCat ) )
				return true;
		}
		return false;
	}
1100193
public static boolean endsWith(CharSequence buf, CharSequence end) {
    int len = end.length(), start = buf.length() - len;
    if(start < 0) {
      return false;
    }
    for(int i = 0; i < len; i++, start++) {
      if(buf.charAt(start) != end.charAt(i)) {
        return false;
      }
    }
    return true;
  }
317520
private void parseFilename() {

    // Add additional filtering to discard empty files, or files ending in .crc
    if ((filename != null) && (filename.length() > 0)
        && (!filename.endsWith(".crc"))) {

      Matcher matcher = PATTERN.matcher(filename);

      if (matcher.matches()) {
    	//  jobTracker = "";
    	  jobid = matcher.group(1);
    	  Matcher confMatcher = CONF_PATTERN.matcher(filename);
    	  if (confMatcher.matches()) {
        	isJobConfFile = true;
        	LOG.debug("Job Conf file  " + filename + " with job id: " + jobid);
        	} else {
        		isJobHistoryFile = true;
        		LOG.debug("Job History file " + filename + " with job id: " + jobid);
        		}
    	  }
      else {
          LOG.info(" file does not match any format: " + filename);
      }
    }
  }
1142511
function isFileExcluded(file) {
        if (file.name[0] === ".") {
            return true;
        }

        var languageID = LanguageManager.getLanguageForPath(file.fullPath).getId();
        if (languageID !== HintUtils.LANGUAGE_ID) {
            return true;
        }

        var excludes = preferences.getExcludedFiles();
        if (excludes && excludes.test(file.name)) {
            return true;
        }

        if (isFileExcludedInternal(file.fullPath)) {
            return true;
        }

        return false;
    }
1224036
@Override
    public boolean isNewLine(byte[]bytes, int p, int end) {
        return p < end ? bytes[p] == Encoding.NEW_LINE : false;
    }
334914
def nontrivial_end_line
      if (last_child = children.last)
        last_child.line_numbers.end - 1
      elsif successor
        successor.line_numbers.begin - 1
      else
        @document.source_lines.count
      end
    end
1074340
static function lineSeparator()
    {
        $ini = eZINI::instance( 'site.ini' );
        $ending = $ini->variable( 'MailSettings', 'HeaderLineEnding' );
        if ( $ending == 'auto' )
        {
            $sys = eZSys::instance();
            // For windows we use \r\n which is the endline defined in RFC 2045
            if ( $sys->osType() == 'win32' )
            {
                $separator = "\r\n";
            }
            else // for linux/unix/mac we use \n only due to some mail transfer agents destroying
                 // emails containing \r\n
            {
                $separator = "\n";
            }
        }
        else
        {
            $separator = urldecode( $ending );
        }

        return $separator;
    }
664343
private function checkAndRegisterLineBreakErrors(): void
    {
        $tokens = $this->getTagTokens();
        $prevToken = [];
        $tagCounts = $this->docTagHelper->getTagCounts($tokens);
        $withReturn = false;

        foreach ($tokens as $tokenPos => $token) {
            $thisTagContent = $token['content'];
            $isReturn = $thisTagContent === '@return';

            $isGroupSwitch =
                // Did we switch the tag ...
                $prevToken && ($prevToken['content'] !== $thisTagContent) &&
                // ... but do we skip singles or are we entering the return block which should contain only 1 tag.
                (($tagCounts[$thisTagContent] !== 1) || ($isReturn && !$withReturn));

            // Insert new line between groups or before the return tag if there is no line break already.
            if ($isGroupSwitch && (($prevToken['line'] + 1) === $token['line'])) {
                $isFixing = $this->file->addFixableWarning(
                    static::MESSAGE_MISSING_NEWLINE_BETWEEN_TAGS,
                    $tokenPos,
                    static::CODE_MISSING_NEWLINE_BETWEEN_TAGS,
                    [
                        $prevToken['content']
                    ]
                );

                if ($isFixing) {
                    $this->insertNewLine($token);
                }
            }

            $prevToken = $token;
            // Return should be the last element, so this is ok.
            $withReturn = $isReturn;
        }
    }
73401
def find_newline(source):
    
    assert not isinstance(source, unicode)

    counter = collections.defaultdict(int)
    for line in source:
        if line.endswith(CRLF):
            counter[CRLF] += 1
        elif line.endswith(CR):
            counter[CR] += 1
        elif line.endswith(LF):
            counter[LF] += 1

    return (sorted(counter, key=counter.get, reverse=True) or [LF])[0]
692958
function translateLineEndings(text, lineEndings) {
        if (lineEndings !== LINE_ENDINGS_CRLF && lineEndings !== LINE_ENDINGS_LF) {
            lineEndings = getPlatformLineEndings();
        }

        var eolStr = (lineEndings === LINE_ENDINGS_CRLF ? "\r\n" : "\n");
        var findAnyEol = /\r\n|\r|\n/g;

        return text.replace(findAnyEol, eolStr);
    }
1348112
private boolean isValidFile(String s, Set<JavaFileObject.Kind> fileKinds) {
        JavaFileObject.Kind kind = getKind(s);
        return fileKinds.contains(kind);
    }
579930
public static boolean hasExtension(File file, String... extensions) {
        String extension = FilenameUtils.getExtension(file.getName());
        for (String s : extensions) {
            if (extension.equalsIgnoreCase(s) || ("." + extension).equalsIgnoreCase(s)) {
                return true;
            }
        }
        return false;
    }
723484
function sniffLineEndings(text) {
        var subset = text.substr(0, 1000);  // (length is clipped to text.length)
        var hasCRLF = /\r\n/.test(subset);
        var hasLF = /[^\r]\n/.test(subset);

        if ((hasCRLF && hasLF) || (!hasCRLF && !hasLF)) {
            return null;
        } else {
            return hasCRLF ? LINE_ENDINGS_CRLF : LINE_ENDINGS_LF;
        }
    }
1159186
protected function end()
    {
        if ($this->literal(';')) {
            return true;
        } elseif ($this->count == strlen($this->buffer) || $this->buffer{$this->count} == '}') {
            // if there is end of file or a closing block next then we don't need a ;
            return true;
        }

        return false;
    }
302308
function endsWith(testStr, endsStr) {
        var index = testStr.lastIndexOf(endsStr);
        if (index < 0) {
            return false;
        }
        if (endsStr.length + index == testStr.length) {
            return true;
        }
        return false;
    }