Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run static analysis with Symfony 6 #183

Merged
merged 5 commits into from
Dec 13, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,20 +37,18 @@ jobs:
tools: composer:v2, flex

- name: Validate composer.json
run: composer validate --no-check-lock

- name: Remove analysis dependencies
run: composer remove --dev --no-update sylius-labs/coding-standard vimeo/psalm
if: matrix.symfony-version == '6.0.*'
run: composer validate --strict

- name: Install dependencies
run: composer install --prefer-dist --no-progress
env:
SYMFONY_REQUIRE: "${{ matrix.symfony-version }}"

- name: Run analysis
run: composer analyse
if: matrix.symfony-version != '6.0.*'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tell me please why do we run static analysis on different versions??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Different versions of dependencies have different APIs - eg. what works with Symfony 4 might not work with Symfony 5.

- name: Run coding standard
run: vendor/bin/ecs check --ansi --no-progress-bar src tests

- name: Run Psalm
run: vendor/bin/psalm src --no-progress --php-version="${{ matrix.php-version }}"

- name: Run tests
run: composer test
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"friends-of-behat/mink-extension": "^2.5",
"friends-of-behat/page-object-extension": "^0.3.2",
"friends-of-behat/service-container-extension": "^1.1",
"sylius-labs/coding-standard": "^3.2",
"sylius-labs/coding-standard": "^4.1.1",
"symfony/browser-kit": "^4.4 || ^5.1 || ^6.0",
"symfony/framework-bundle": "^4.4 || ^5.1 || ^6.0",
"symfony/process": "^4.4 || ^5.1 || ^6.0",
Expand Down
2 changes: 0 additions & 2 deletions easy-coding-standard.yml

This file was deleted.

9 changes: 9 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;

return static function (ContainerConfigurator $containerConfigurator): void {
$containerConfigurator->import(__DIR__ . '/vendor/sylius-labs/coding-standard/ecs.php');
};
7 changes: 7 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,5 +27,12 @@
<file name="src/Mink/MinkParameters.php" />
</errorLevel>
</InvalidAttribute>

<!-- Workaround for https://github.com/vimeo/psalm/issues/7026 -->
<ReservedWord>
<errorLevel type="suppress">
<directory name="src" />
</errorLevel>
</ReservedWord>
</issueHandlers>
</psalm>
19 changes: 14 additions & 5 deletions tests/Behat/Context/TestContext.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ public function standardSymfonyAutoloaderConfigured(): void
*/
public function workingSymfonyApplicationWithExtension(): void
{
$this->thereIsConfiguration(<<<'CON'
$this->thereIsConfiguration(
<<<'CON'
default:
extensions:
FriendsOfBehat\SymfonyExtension:
Expand All @@ -89,7 +90,9 @@ class: App\Kernel

$this->standardSymfonyAutoloaderConfigured();

$this->thereIsFile('src/Kernel.php', <<<'CON'
$this->thereIsFile(
'src/Kernel.php',
<<<'CON'
<?php

declare(strict_types=1);
Expand Down Expand Up @@ -140,7 +143,9 @@ protected function configureRoutes($routes): void
CON
);

$this->thereIsFile('src/Controller.php', <<<'CON'
$this->thereIsFile(
'src/Controller.php',
<<<'CON'
<?php

declare(strict_types=1);
Expand Down Expand Up @@ -168,7 +173,9 @@ public function helloWorld(): Response
CON
);

$this->thereIsFile('src/Counter.php', <<<'CON'
$this->thereIsFile(
'src/Counter.php',
<<<'CON'
<?php

declare(strict_types=1);
Expand All @@ -192,7 +199,9 @@ public function get(): int
CON
);

$this->thereIsFile('config/default.yaml', <<<'YML'
$this->thereIsFile(
'config/default.yaml',
<<<'YML'
services:
App\Controller:
arguments:
Expand Down