pht('Configure your editor to use spaces for indentation.'),
"\t");
}
}
protectedfunctionlintLineLength($path){
$lines=explode("\n",$this->getData($path));
$width=$this->maxLineLength;
foreach($linesas$line_idx=>$line){
if(strlen($line)>$width){
$this->raiseLintAtLine(
$line_idx+1,
1,
self::LINT_LINE_WRAP,
pht(
'This line is %s characters long, but the '.
'convention is %s characters.',
newPhutilNumber(strlen($line)),
$width),
$line);
}
}
}
protectedfunctionlintEOFNewline($path){
$data=$this->getData($path);
if(!strlen($data)||$data[strlen($data)-1]!="\n"){
$this->raiseLintAtOffset(
strlen($data),
self::LINT_EOF_NEWLINE,
pht('Files must end in a newline.'),
'',
"\n");
}
}
protectedfunctionlintCharset($path){
$data=$this->getData($path);
$matches=null;
$bad='!!u';// In theory, '[^\x09\x0A\x20-\x7E\p{L}\p{M}\p{N}\p{P}\p{S}]' from https://secure.phabricator.com/D16085 might work, but I haven't adapted this enough to make that actually work, so we're just allowing ALL utf8 characters for now
$preg=preg_match_all(
"/{$bad}(.*{$bad})?/",
$data,
$matches,
PREG_OFFSET_CAPTURE);
if(!$preg){
return;
}
foreach($matches[0]as$match){
list($string,$offset)=$match;
$this->raiseLintAtOffset(
$offset,
self::LINT_BAD_CHARSET,
pht(
'Source code should contain only UTF-8 charsets.'),