diff --git a/HeuristicAnalyser.php b/HeuristicAnalyser.php index 9e55118..f009e51 100644 --- a/HeuristicAnalyser.php +++ b/HeuristicAnalyser.php @@ -209,7 +209,7 @@ public function __construct($input, $self = null) $this->path = $input['path']; $this->curr_dir = dirname($this->path); $this->extension = pathinfo($this->path, PATHINFO_EXTENSION); - $this->checkFileSize(filesize($this->path)); + $this->checkFileSize((int)filesize($this->path)); $this->checkFileAccessibility(); $this->file_size = (int)filesize($this->path); $this->file_work = file_get_contents($this->path); @@ -287,9 +287,13 @@ public function processContent() // Analysing code style // Do this, only for initial code if ( ! $this->evaluations->evaluations ) { - if ( $this->extension !== 'html' && $this->extension !== 'js' ) { - //todo turn this back after task finished https://doboard.com/1/task/6692 - //$this->code_style->analyseLineLengths($this->file_content); + if ( + $this->extension !== 'html' && + $this->extension !== 'htm' && + $this->extension !== 'shtml' && + $this->extension !== 'js' + ) { + $this->code_style->analyseLineLengths($this->file_content); $this->code_style->analyseHumanUnreadableCode($this->file_content); $this->code_style->analyseWeightOfNoise($this->file_content); } diff --git a/Modules/CodeStyle.php b/Modules/CodeStyle.php index c5688c4..dc25041 100644 --- a/Modules/CodeStyle.php +++ b/Modules/CodeStyle.php @@ -132,7 +132,7 @@ public function analyseLineLengths(&$content) for ( $line_num = 1; isset($lines[$line_num - 1]); $line_num++ ) { try { $line = $lines[$line_num - 1]; - if ($this->analyseLineLengthsIsExceptions($line)) { + if ($this->analyseLineLengthsIsExcludedForLine($line)) { continue; } if ( strlen($line) > self::CRITICAL_CODE_STRING_LENGTH ) { @@ -145,12 +145,13 @@ public function analyseLineLengths(&$content) } /** - * Check exceptions for long line + * Check if the line should be skipped. + * Uses regexps of known signs to exclude. * * @param string $line * @return bool */ - public function analyseLineLengthsIsExceptions($line) + public function analyseLineLengthsIsExcludedForLine($line) { if (preg_match('#^\s*#', $line, $match)) { return true;