From 50201645038fd5513319176e5c4bb9ab4577224e Mon Sep 17 00:00:00 2001 From: Glomberg Date: Fri, 21 Jun 2024 14:13:11 +0300 Subject: [PATCH 1/4] Fix. Scanner. Heuristic scanner PHP 8.3 support fixed. --- Modules/Tokens.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Modules/Tokens.php b/Modules/Tokens.php index 166b982..6a0d3df 100644 --- a/Modules/Tokens.php +++ b/Modules/Tokens.php @@ -17,6 +17,7 @@ * @property Token|null $next3 Iteration Token * @property Token|null $next4 Iteration Token */ +#[\AllowDynamicProperties] class Tokens implements \Iterator, \ArrayAccess, \Countable { /** From f865469d691866820bf88467921c021f3395d036 Mon Sep 17 00:00:00 2001 From: Glomberg Date: Fri, 21 Jun 2024 14:18:57 +0300 Subject: [PATCH 2/4] Upd. Code. Index files added. --- DataStructures/index.php | 1 + Exceptions/index.php | 1 + Modules/index.php | 1 + Structures/index.php | 1 + Vendors/TiktokenPhp/data/index.php | 1 + Vendors/TiktokenPhp/index.php | 1 + Vendors/TiktokenPhp/src/index.php | 1 + Vendors/index.php | 1 + 8 files changed, 8 insertions(+) create mode 100644 DataStructures/index.php create mode 100644 Exceptions/index.php create mode 100644 Modules/index.php create mode 100644 Structures/index.php create mode 100644 Vendors/TiktokenPhp/data/index.php create mode 100644 Vendors/TiktokenPhp/index.php create mode 100644 Vendors/TiktokenPhp/src/index.php create mode 100644 Vendors/index.php diff --git a/DataStructures/index.php b/DataStructures/index.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/DataStructures/index.php @@ -0,0 +1 @@ + Date: Fri, 21 Jun 2024 14:19:26 +0300 Subject: [PATCH 3/4] Upd. Code. Index files added. --- .gitignore | 1 - index.php | 1 + 2 files changed, 1 insertion(+), 1 deletion(-) create mode 100644 index.php diff --git a/.gitignore b/.gitignore index 3a7440a..2631d4f 100644 --- a/.gitignore +++ b/.gitignore @@ -4,4 +4,3 @@ composer.lock package-lock.json /lib/ /bad/ -/index.php diff --git a/index.php b/index.php new file mode 100644 index 0000000..b3d9bbc --- /dev/null +++ b/index.php @@ -0,0 +1 @@ + Date: Tue, 25 Jun 2024 09:47:25 +0300 Subject: [PATCH 4/4] Upd. Code. Get changes from SPBCT. --- HeuristicAnalyser.php | 12 ++++++++---- Modules/CodeStyle.php | 7 ++++--- 2 files changed, 12 insertions(+), 7 deletions(-) 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;