Skip to content

Commit

Permalink
Upd. Skipping svg in long line check.
Browse files Browse the repository at this point in the history
  • Loading branch information
svfcode committed Feb 20, 2024
1 parent 92b06ab commit 0d68ea1
Showing 1 changed file with 20 additions and 1 deletion.
21 changes: 20 additions & 1 deletion Modules/CodeStyle.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,11 @@ public function analyseLineLengths(&$content)

for ( $line_num = 1; isset($lines[$line_num - 1]); $line_num++ ) {
try {
if ( strlen($lines[$line_num - 1]) > self::CRITICAL_CODE_STRING_LENGTH ) {
$line = $lines[$line_num - 1];
if ($this->analyseLineLengthsIsExceptions($line)) {
continue;
}
if ( strlen($line) > self::CRITICAL_CODE_STRING_LENGTH ) {
$this->critical_long_line_nums[] = $line_num;
}
} catch (\Exception $_e) {
Expand All @@ -71,6 +75,21 @@ public function analyseLineLengths(&$content)
}
}

/**
* Check exceptions for long line
*
* @param string $line
* @return bool
*/
public function analyseLineLengthsIsExceptions($line)
{
if (preg_match('#^\s*<path\s+d="[^$][.\w\s-]+"\s*\/>#', $line, $match)) {
return true;
}

return false;
}

public function analyseUnreadableCode(&$content)
{
$proportion_spec_symbols = $this->proportionOfSpecialSymbols();
Expand Down

0 comments on commit 0d68ea1

Please sign in to comment.