Correl Roush
d53e4e74f1
git-svn-id: file:///srv/svn/scanner/trunk@2 a0501263-5b7a-4423-a8ba-1edf086583e7
28 lines
611 B
PHP
28 lines
611 B
PHP
<?php
|
|
class LintModule extends ScannerModule {
|
|
function LintModule() {
|
|
$this->ScannerModule();
|
|
}
|
|
function preScan( $filename ) {
|
|
parent::preScan( $filename );
|
|
$output = array();
|
|
exec( "php -l '$filename' 2>/dev/null", $output, $result );
|
|
if( $result != 0 ) {
|
|
foreach( $output as $linterror ) {
|
|
$matches = array();
|
|
if( preg_match( '/error:.*?on line (\d+)$/i', $linterror, $matches ) == 0 ) { continue; }
|
|
$this->fault(
|
|
array(
|
|
'file' => $filename,
|
|
'line' => $matches[1]
|
|
),
|
|
FAULT_MAJOR,
|
|
$linterror
|
|
);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
$modules[] = new LintModule();
|
|
?>
|