From 682c48ab7debdb91191478e6bffa2101bdd4f372 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 13:15:38 +0000 Subject: [PATCH] build(deps): bump hoverkraft-tech/ci-github-common Bumps the github-actions-dependencies group with 1 update: [hoverkraft-tech/ci-github-common](https://github.com/hoverkraft-tech/ci-github-common). Updates `hoverkraft-tech/ci-github-common` from 0.23.1 to 0.24.0 - [Release notes](https://github.com/hoverkraft-tech/ci-github-common/releases) - [Commits](https://github.com/hoverkraft-tech/ci-github-common/compare/6857ef6d10f704e0998aa4955282f27d1b9be778...b4883995e100e291a1fed68678d47a560328ed08) --- updated-dependencies: - dependency-name: hoverkraft-tech/ci-github-common dependency-version: 0.24.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: github-actions-dependencies ... Signed-off-by: dependabot[bot] Signed-off-by: Emilien Escalle --- .github/workflows/need-fix-to-issue.yml | 2 +- .github/workflows/stale.yml | 2 +- composer.json | 15 +-- src/CssLint/Cli.php | 104 +++++++++--------- src/CssLint/Tokenizer/Parser/BlockParser.php | 4 +- tests/TestSuite/CliTest.php | 54 ++++----- tests/TestSuite/LinterTest.php | 12 +- .../Formatter/GithubActionsFormatterTest.php | 4 +- tools/composer.json | 2 + 9 files changed, 99 insertions(+), 100 deletions(-) diff --git a/.github/workflows/need-fix-to-issue.yml b/.github/workflows/need-fix-to-issue.yml index f2e6ccd..584f42e 100644 --- a/.github/workflows/need-fix-to-issue.yml +++ b/.github/workflows/need-fix-to-issue.yml @@ -19,7 +19,7 @@ concurrency: jobs: main: - uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@6857ef6d10f704e0998aa4955282f27d1b9be778 # 0.23.1 + uses: hoverkraft-tech/ci-github-common/.github/workflows/need-fix-to-issue.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0 with: manual-commit-ref: ${{ inputs.manual-commit-ref }} manual-base-ref: ${{ inputs.manual-base-ref }} diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index f4db988..44634d5 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -6,4 +6,4 @@ on: jobs: main: - uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@6857ef6d10f704e0998aa4955282f27d1b9be778 # 0.23.1 + uses: hoverkraft-tech/ci-github-common/.github/workflows/stale.yml@b4883995e100e291a1fed68678d47a560328ed08 # 0.24.0 diff --git a/composer.json b/composer.json index a6dd114..01309cb 100644 --- a/composer.json +++ b/composer.json @@ -17,6 +17,11 @@ "name": "Neilime", "homepage": "https://github.com/neilime", "role": "Developer" + }, + { + "name": "ESCEMI", + "homepage": "https://github.com/escemi-tech", + "role": "Developer" } ], "support": { @@ -77,14 +82,6 @@ }, "config": { "optimize-autoloader": true, - "sort-packages": true, - "allow-plugins": { - "phpstan/extension-installer": true - } - }, - "extra": { - "branch-alias": { - "dev-master": "1.0-dev" - } + "sort-packages": true } } diff --git a/src/CssLint/Cli.php b/src/CssLint/Cli.php index e20b312..9a0fc2d 100644 --- a/src/CssLint/Cli.php +++ b/src/CssLint/Cli.php @@ -70,58 +70,58 @@ private function printUsage(): void $defaultFormatter = $availableFormatters[0]; $this->printLine( - 'Usage:' . PHP_EOL . - '------' . PHP_EOL . - PHP_EOL . - ' ' . self::SCRIPT_NAME . " [--options='{ }'] [--formatter=name] [--formatter=name:path] input_to_lint" . PHP_EOL . - PHP_EOL . - 'Arguments:' . PHP_EOL . - '----------' . PHP_EOL . - PHP_EOL . - ' --options' . PHP_EOL . - ' Options (optional), must be a json object:' . PHP_EOL . - ' * "allowedIndentationChars" => [" "] or ["\t"]: will override the current property' . PHP_EOL . - ' * "constructors": { "property" => bool }: will merge with the current property' . PHP_EOL . - ' * "standards": { "property" => bool }: will merge with the current property' . PHP_EOL . - ' * "nonStandards": { "property" => bool }: will merge with the current property' . PHP_EOL . - ' Example: --options=\'{ "constructors": {"o" : false}, "allowedIndentationChars": ["\t"] }\'' . - PHP_EOL . - PHP_EOL . - ' --formatter' . PHP_EOL . - ' The formatter(s) to be used. Can be specified multiple times.' . PHP_EOL . - ' Format: --formatter=name (output to stdout) or --formatter=name:path (output to file)' . PHP_EOL . - ' If not specified, the default formatter will output to stdout.' . PHP_EOL . - ' Available formatters: ' . implode(', ', $availableFormatters) . PHP_EOL . - ' Examples:' . PHP_EOL . - ' output to stdout: --formatter=' . $defaultFormatter . PHP_EOL . - ' output to file: --formatter=' . $defaultFormatter . ':report.txt' . PHP_EOL . - ' multiple outputs: --formatter=' . $defaultFormatter . ' --formatter=' . $availableFormatters[1] . ':report.json' . PHP_EOL . - PHP_EOL . - ' input_to_lint' . PHP_EOL . - ' The CSS file path (absolute or relative)' . PHP_EOL . - ' a glob pattern of file(s) to be linted' . PHP_EOL . - ' or a CSS string to be linted' . PHP_EOL . - ' Example:' . PHP_EOL . - ' "./path/to/css_file_path_to_lint.css"' . PHP_EOL . - ' "./path/to/css_file_path_to_lint/*.css"' . PHP_EOL . - ' ".test { color: red; }"' . PHP_EOL . - PHP_EOL . - 'Examples:' . PHP_EOL . - '---------' . PHP_EOL . - PHP_EOL . - ' Lint a CSS file:' . PHP_EOL . - ' ' . self::SCRIPT_NAME . ' "./path/to/css_file_path_to_lint.css"' . PHP_EOL . PHP_EOL . - ' Lint a CSS string:' . PHP_EOL . - ' ' . self::SCRIPT_NAME . ' ".test { color: red; }"' . PHP_EOL . PHP_EOL . - ' Lint with only tabulation as indentation:' . PHP_EOL . - ' ' . self::SCRIPT_NAME . - ' --options=\'{ "allowedIndentationChars": ["\t"] }\' ".test { color: red; }"' . PHP_EOL . PHP_EOL . - ' Output to a file:' . PHP_EOL . - ' ' . self::SCRIPT_NAME . ' --formatter=plain:output.txt ".test { color: red; }"' . PHP_EOL . PHP_EOL . - ' Generate GitLab CI report:' . PHP_EOL . - ' ' . self::SCRIPT_NAME . ' --formatter=gitlab-ci:report.json "./path/to/css_file.css"' . PHP_EOL . PHP_EOL . - ' Multiple outputs (console and file):' . PHP_EOL . - ' ' . self::SCRIPT_NAME . ' --formatter=plain --formatter=gitlab-ci:ci-report.json ".test { color: red; }"' . PHP_EOL . PHP_EOL + 'Usage:' . PHP_EOL + . '------' . PHP_EOL + . PHP_EOL + . ' ' . self::SCRIPT_NAME . " [--options='{ }'] [--formatter=name] [--formatter=name:path] input_to_lint" . PHP_EOL + . PHP_EOL + . 'Arguments:' . PHP_EOL + . '----------' . PHP_EOL + . PHP_EOL + . ' --options' . PHP_EOL + . ' Options (optional), must be a json object:' . PHP_EOL + . ' * "allowedIndentationChars" => [" "] or ["\t"]: will override the current property' . PHP_EOL + . ' * "constructors": { "property" => bool }: will merge with the current property' . PHP_EOL + . ' * "standards": { "property" => bool }: will merge with the current property' . PHP_EOL + . ' * "nonStandards": { "property" => bool }: will merge with the current property' . PHP_EOL + . ' Example: --options=\'{ "constructors": {"o" : false}, "allowedIndentationChars": ["\t"] }\'' + . PHP_EOL + . PHP_EOL + . ' --formatter' . PHP_EOL + . ' The formatter(s) to be used. Can be specified multiple times.' . PHP_EOL + . ' Format: --formatter=name (output to stdout) or --formatter=name:path (output to file)' . PHP_EOL + . ' If not specified, the default formatter will output to stdout.' . PHP_EOL + . ' Available formatters: ' . implode(', ', $availableFormatters) . PHP_EOL + . ' Examples:' . PHP_EOL + . ' output to stdout: --formatter=' . $defaultFormatter . PHP_EOL + . ' output to file: --formatter=' . $defaultFormatter . ':report.txt' . PHP_EOL + . ' multiple outputs: --formatter=' . $defaultFormatter . ' --formatter=' . $availableFormatters[1] . ':report.json' . PHP_EOL + . PHP_EOL + . ' input_to_lint' . PHP_EOL + . ' The CSS file path (absolute or relative)' . PHP_EOL + . ' a glob pattern of file(s) to be linted' . PHP_EOL + . ' or a CSS string to be linted' . PHP_EOL + . ' Example:' . PHP_EOL + . ' "./path/to/css_file_path_to_lint.css"' . PHP_EOL + . ' "./path/to/css_file_path_to_lint/*.css"' . PHP_EOL + . ' ".test { color: red; }"' . PHP_EOL + . PHP_EOL + . 'Examples:' . PHP_EOL + . '---------' . PHP_EOL + . PHP_EOL + . ' Lint a CSS file:' . PHP_EOL + . ' ' . self::SCRIPT_NAME . ' "./path/to/css_file_path_to_lint.css"' . PHP_EOL . PHP_EOL + . ' Lint a CSS string:' . PHP_EOL + . ' ' . self::SCRIPT_NAME . ' ".test { color: red; }"' . PHP_EOL . PHP_EOL + . ' Lint with only tabulation as indentation:' . PHP_EOL + . ' ' . self::SCRIPT_NAME + . ' --options=\'{ "allowedIndentationChars": ["\t"] }\' ".test { color: red; }"' . PHP_EOL . PHP_EOL + . ' Output to a file:' . PHP_EOL + . ' ' . self::SCRIPT_NAME . ' --formatter=plain:output.txt ".test { color: red; }"' . PHP_EOL . PHP_EOL + . ' Generate GitLab CI report:' . PHP_EOL + . ' ' . self::SCRIPT_NAME . ' --formatter=gitlab-ci:report.json "./path/to/css_file.css"' . PHP_EOL . PHP_EOL + . ' Multiple outputs (console and file):' . PHP_EOL + . ' ' . self::SCRIPT_NAME . ' --formatter=plain --formatter=gitlab-ci:ci-report.json ".test { color: red; }"' . PHP_EOL . PHP_EOL ); } diff --git a/src/CssLint/Tokenizer/Parser/BlockParser.php b/src/CssLint/Tokenizer/Parser/BlockParser.php index 364c82a..128b9c9 100644 --- a/src/CssLint/Tokenizer/Parser/BlockParser.php +++ b/src/CssLint/Tokenizer/Parser/BlockParser.php @@ -66,7 +66,7 @@ public static function getBlockContent(TokenizerContext $tokenizerContext): stri /** * Performs parsing tokenizer current context, check block part */ - public function parseCurrentContext(TokenizerContext $tokenizerContext): BlockToken|null + public function parseCurrentContext(TokenizerContext $tokenizerContext): ?BlockToken { if ($this->lastCharIsSpace($tokenizerContext)) { return null; @@ -76,7 +76,7 @@ public function parseCurrentContext(TokenizerContext $tokenizerContext): BlockTo return $this->handleBlockToken($tokenizerContext, $currentBlockToken); } - private function handleBlockToken(TokenizerContext $tokenizerContext, ?BlockToken $currentBlockToken): BlockToken|null + private function handleBlockToken(TokenizerContext $tokenizerContext, ?BlockToken $currentBlockToken): ?BlockToken { if (static::isBlockStart($tokenizerContext)) { $blockToken = $this->createBlockToken($tokenizerContext); diff --git a/tests/TestSuite/CliTest.php b/tests/TestSuite/CliTest.php index 25c48c0..fa49d9a 100644 --- a/tests/TestSuite/CliTest.php +++ b/tests/TestSuite/CliTest.php @@ -48,9 +48,9 @@ public function testRunWithoutArgumentMustReturnsErrorCode() public function testRunWithValidStringShouldReturnSuccessCode() { $this->expectOutputString( - '# Lint CSS string...' . PHP_EOL . - "\033[32m => Success: CSS string is valid.\033[0m" . PHP_EOL . - PHP_EOL + '# Lint CSS string...' . PHP_EOL + . "\033[32m => Success: CSS string is valid.\033[0m" . PHP_EOL + . PHP_EOL ); $this->assertEquals( 0, @@ -62,10 +62,10 @@ public function testRunWithValidStringShouldReturnSuccessCode() public function testRunWithNotValidStringShouldReturnErrorCode() { $this->expectOutputString( - '# Lint CSS string...' . PHP_EOL . - "\033[31m - [unexpected_character_in_block_content]: block - Unexpected character: \":\" (line 1, column 6 to line 3, column 16)\033[0m" . PHP_EOL . - "\033[31m - [invalid_property_declaration]: property - Unknown property \"displady\" (line 1, column 7 to line 1, column 23)\033[0m" . PHP_EOL . - "\033[31m => Failure: CSS string is invalid CSS.\033[0m" . PHP_EOL + '# Lint CSS string...' . PHP_EOL + . "\033[31m - [unexpected_character_in_block_content]: block - Unexpected character: \":\" (line 1, column 6 to line 3, column 16)\033[0m" . PHP_EOL + . "\033[31m - [invalid_property_declaration]: property - Unknown property \"displady\" (line 1, column 7 to line 1, column 23)\033[0m" . PHP_EOL + . "\033[31m => Failure: CSS string is invalid CSS.\033[0m" . PHP_EOL ); $this->assertEquals(1, $this->cli->run([ @@ -81,10 +81,10 @@ public function testRunWithNotValidFileShouldReturnErrorCode() $fileToLint = $this->testFixturesDir . '/not_valid.css'; $this->expectOutputString( - "# Lint CSS file \"$fileToLint\"..." . PHP_EOL . - "\033[31m - [invalid_property_declaration]: property - Unknown property \"bordr-top-style\" (line 3, column 5 to line 3, column 27)\033[0m" . PHP_EOL . - "\033[31m - [unclosed_token]: block - Unclosed \"block\" detected (line 1, column 23 to line 6, column 2)\033[0m" . PHP_EOL . - "\033[31m => Failure: CSS file \"$fileToLint\" is invalid CSS.\033[0m" . PHP_EOL + "# Lint CSS file \"$fileToLint\"..." . PHP_EOL + . "\033[31m - [invalid_property_declaration]: property - Unknown property \"bordr-top-style\" (line 3, column 5 to line 3, column 27)\033[0m" . PHP_EOL + . "\033[31m - [unclosed_token]: block - Unclosed \"block\" detected (line 1, column 23 to line 6, column 2)\033[0m" . PHP_EOL + . "\033[31m => Failure: CSS file \"$fileToLint\" is invalid CSS.\033[0m" . PHP_EOL ); $this->assertEquals(1, $this->cli->run(['php-css-lint', $fileToLint])); } @@ -93,9 +93,9 @@ public function testRunWithGlobShouldReturnSuccessCode() { $fileToLint = $this->testFixturesDir . '/valid.css'; $this->expectOutputString( - "# Lint CSS file \"$fileToLint\"..." . PHP_EOL . - "\033[32m => Success: CSS file \"$fileToLint\" is valid.\033[0m" . PHP_EOL . - PHP_EOL + "# Lint CSS file \"$fileToLint\"..." . PHP_EOL + . "\033[32m => Success: CSS file \"$fileToLint\" is valid.\033[0m" . PHP_EOL + . PHP_EOL ); $this->assertEquals(0, $this->cli->run(['php-css-lint', $this->testFixturesDir . '/valid*.css']), $this->getActualOutput()); } @@ -114,10 +114,10 @@ public function testRunWithNotValidFileGlobShouldReturnErrorCode() { $fileToLint = $this->testFixturesDir . '/not_valid.css'; $this->expectOutputString( - "# Lint CSS file \"$fileToLint\"..." . PHP_EOL . - "\033[31m - [invalid_property_declaration]: property - Unknown property \"bordr-top-style\" (line 3, column 5 to line 3, column 27)\033[0m" . PHP_EOL . - "\033[31m - [unclosed_token]: block - Unclosed \"block\" detected (line 1, column 23 to line 6, column 2)\033[0m" . PHP_EOL . - "\033[31m => Failure: CSS file \"$fileToLint\" is invalid CSS.\033[0m" . PHP_EOL + "# Lint CSS file \"$fileToLint\"..." . PHP_EOL + . "\033[31m - [invalid_property_declaration]: property - Unknown property \"bordr-top-style\" (line 3, column 5 to line 3, column 27)\033[0m" . PHP_EOL + . "\033[31m - [unclosed_token]: block - Unclosed \"block\" detected (line 1, column 23 to line 6, column 2)\033[0m" . PHP_EOL + . "\033[31m => Failure: CSS file \"$fileToLint\" is invalid CSS.\033[0m" . PHP_EOL ); $this->assertEquals(1, $this->cli->run(['php-css-lint', $this->testFixturesDir . '/not_valid*.css'])); } @@ -125,9 +125,9 @@ public function testRunWithNotValidFileGlobShouldReturnErrorCode() public function testRunWithOptionsMustBeUsedByTheLinter() { $this->expectOutputString( - "# Lint CSS string..." . PHP_EOL . - "\033[31m - [invalid_indentation_character]: whitespace - Unexpected char \" \" (line 2, column 1 to line 2, column 2)\033[0m" . PHP_EOL . - "\033[31m => Failure: CSS string is invalid CSS.\033[0m" . PHP_EOL + "# Lint CSS string..." . PHP_EOL + . "\033[31m - [invalid_indentation_character]: whitespace - Unexpected char \" \" (line 2, column 1 to line 2, column 2)\033[0m" . PHP_EOL + . "\033[31m => Failure: CSS string is invalid CSS.\033[0m" . PHP_EOL ); $this->assertEquals(1, $this->cli->run([ @@ -168,9 +168,9 @@ public function testRunWithFormatterArgumentShouldReturnSuccessCode() { $fileToLint = $this->testFixturesDir . '/valid.css'; $this->expectOutputString( - "::group::Lint CSS file \"$fileToLint\"" . PHP_EOL . - "::notice ::Success: CSS file \"$fileToLint\" is valid." . PHP_EOL . - "::endgroup::" . PHP_EOL + "::group::Lint CSS file \"$fileToLint\"" . PHP_EOL + . "::notice ::Success: CSS file \"$fileToLint\" is valid." . PHP_EOL + . "::endgroup::" . PHP_EOL ); $this->assertEquals(0, $this->cli->run(['php-css-lint', '--formatter=github-actions', $fileToLint]), $this->getActualOutput()); } @@ -203,9 +203,9 @@ public function testRunWithValidFileShouldReturnSuccessCode(string $fileToLint) { $fileToLint = $this->testFixturesDir . '/' . $fileToLint; $this->expectOutputString( - "# Lint CSS file \"$fileToLint\"..." . PHP_EOL . - "\033[32m => Success: CSS file \"$fileToLint\" is valid.\033[0m" . PHP_EOL . - PHP_EOL + "# Lint CSS file \"$fileToLint\"..." . PHP_EOL + . "\033[32m => Success: CSS file \"$fileToLint\" is valid.\033[0m" . PHP_EOL + . PHP_EOL ); $this->assertEquals(0, $this->cli->run(['php-css-lint', $fileToLint]), $this->getActualOutput()); } diff --git a/tests/TestSuite/LinterTest.php b/tests/TestSuite/LinterTest.php index e72dc95..6a5c5c6 100644 --- a/tests/TestSuite/LinterTest.php +++ b/tests/TestSuite/LinterTest.php @@ -196,12 +196,12 @@ public function testLintFileWithUnreadableFilePathParam() public function testLintComment() { // Act - $errors = - $this->linter->lintString( - "/*" . PHP_EOL . - " * This is a comment" . PHP_EOL . - "*/" . PHP_EOL . - ".test { }" + $errors + = $this->linter->lintString( + "/*" . PHP_EOL + . " * This is a comment" . PHP_EOL + . "*/" . PHP_EOL + . ".test { }" ); // Assert diff --git a/tests/TestSuite/Output/Formatter/GithubActionsFormatterTest.php b/tests/TestSuite/Output/Formatter/GithubActionsFormatterTest.php index 7f85406..7baec74 100644 --- a/tests/TestSuite/Output/Formatter/GithubActionsFormatterTest.php +++ b/tests/TestSuite/Output/Formatter/GithubActionsFormatterTest.php @@ -88,8 +88,8 @@ public function testEndLintingOutputsEndGroup(): void // Assert $this->assertSame( - "::notice ::Success: file.css is valid." . PHP_EOL . - "::endgroup::" . PHP_EOL, + "::notice ::Success: file.css is valid." . PHP_EOL + . "::endgroup::" . PHP_EOL, $content ); } diff --git a/tools/composer.json b/tools/composer.json index 689bf26..3c21af6 100644 --- a/tools/composer.json +++ b/tools/composer.json @@ -8,6 +8,8 @@ "rector/rector": "^2.1" }, "config": { + "optimize-autoloader": true, + "sort-packages": true, "allow-plugins": { "phpstan/extension-installer": true }