Skip to content

Commit

Permalink
Adjust static calls in multiple rules
Browse files Browse the repository at this point in the history
This commit removes the redundant artifact upload step from the GitHub Actions workflow as it was unnecessary for the process. Also, the self::compare() calls have been replaced with static::compare() in AbstractAggregateRuleCombo, AbstractCellRuleCombo, and the pattern for BIC number verification in IsBic rule has been updated for better matching. Changes also include commenting on the NOSONAR issue where applicable.
  • Loading branch information
SmetDenis committed Apr 12, 2024
1 parent 7701d8a commit e8d6af8
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 25 deletions.
21 changes: 0 additions & 21 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,6 @@ jobs:
- name: 👍 Code Quality
run: make codestyle --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Tests - Current
path: build/


test-lowest-versions:
name: Tests - Lowest
Expand Down Expand Up @@ -117,13 +110,6 @@ jobs:
- name: 👍 Code Quality
run: make codestyle --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Tests - Lowest
path: build/


test-latest-libs:
name: Tests - Latest
Expand Down Expand Up @@ -156,13 +142,6 @@ jobs:
- name: 👍 Code Quality
run: make codestyle --no-print-directory

- name: Upload Artifacts
uses: actions/upload-artifact@v4
continue-on-error: true
with:
name: Tests - Latest
path: build/


verify-php-binary:
name: Verify PHP binary
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/Aggregate/AbstractAggregateRuleCombo.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ protected function validateComboAggregate(array $colValues, string $mode): ?stri
return "<red>{$exception->getMessage()}</red>"; // TODO: Expose the error/warning message in the report?
}

if (!self::compare($expected, $actual, $mode)) {
if (!static::compare($expected, $actual, $mode)) {
return "The {$name} in the column is \"<c>{$actual}</c>\", " .
"which is {$verb} than the {$prefix}expected \"<green>{$expected}</green>\"";
}
Expand Down
2 changes: 1 addition & 1 deletion src/Rules/Cell/AbstractCellRuleCombo.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ protected function validateComboCell(string $cellValue, ?string $mode = null): ?
return null;
}

if (!self::compare($this->getExpected(), $this->getActual($cellValue), $mode)) {
if (!static::compare($this->getExpected(), $this->getActual($cellValue), $mode)) {
return $this->getErrorMessage($cellValue, $mode);
}

Expand Down
2 changes: 1 addition & 1 deletion src/Rules/Cell/IsBic.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public function validateRule(string $cellValue): ?string
return null;
}

if (\preg_match('/^[A-Za-z]{4}[A-Za-z]{2}[A-Za-z0-9]{2}([A-Za-z0-9]{3})?$/', $cellValue) === 0) {
if (\preg_match('/^[a-z]{4}[a-z]{2}[a-z0-9]{2}([a-z0-9]{3})?$/i', $cellValue) === 0) { // NOSONAR
return "The value \"<c>{$cellValue}</c>\" is not a valid BIC number (ISO 9362).";
}

Expand Down
2 changes: 1 addition & 1 deletion src/Utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ public static function kebabToCamelCase(string $input): string

public static function camelToKebabCase(string $input): string
{
return \strtolower((string)\preg_replace('/(?<!^)[A-Z]/', '_$0', $input));
return \strtolower((string)\preg_replace('/(?<!^)[A-Z]/', '_$0', $input)); // NOSONAR
}

public static function prepareRegex(?string $pattern, string $addDelimiter = '/'): ?string
Expand Down

0 comments on commit e8d6af8

Please sign in to comment.