Skip to content

Commit

Permalink
Merge 58b9bf6 into d49733c
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Jul 6, 2020
2 parents d49733c + 58b9bf6 commit 64a8f99
Show file tree
Hide file tree
Showing 49 changed files with 148 additions and 230 deletions.
45 changes: 45 additions & 0 deletions .github/workflows/code_analysis.yaml
@@ -0,0 +1,45 @@
name: Code Analysis

on:
pull_request: null
push:
branches:
- master

jobs:
matrix:
strategy:
fail-fast: false
matrix:
actions:
-
name: 'PHPStan'
run: composer phpstan

-
name: 'ECS'
run: composer check-cs

-
name: 'Rector'
run: composer rector

-
name: 'Code Sniffer Set Run'
run: 'vendor/bin/phpcs src tests -sp --standard=src/ObjectCalisthenics/ruleset.xml --extensions=php'

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
# see https://github.com/shivammathur/setup-php
- uses: shivammathur/setup-php@v1
with:
php-version: 7.4
coverage: none

- run: composer install --no-progress

-
name: ${{ matrix.actions.name }}
run: ${{ matrix.actions.run }}
20 changes: 0 additions & 20 deletions .github/workflows/code_sniffer_set_run.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/ecs.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/phpstan.yaml

This file was deleted.

20 changes: 0 additions & 20 deletions .github/workflows/rector.yaml

This file was deleted.

23 changes: 12 additions & 11 deletions composer.json
Expand Up @@ -6,18 +6,19 @@
"require": {
"php": "^7.2",
"nette/utils": "^3.1",
"slevomat/coding-standard": "^6.2",
"slevomat/coding-standard": "^6.3",
"squizlabs/php_codesniffer": "^3.5"
},
"require-dev": {
"phpstan/phpstan": "^0.12.18",
"phpstan/phpstan": "^0.12.32",
"phpunit/phpunit": "^8.5|^9.0",
"rector/rector": "^0.7.9",
"symplify/changelog-linker": "^7.2",
"symplify/coding-standard": "^7.2",
"symplify/easy-coding-standard-tester": "^7.2",
"symplify/phpstan-extensions": "^7.2",
"tracy/tracy": "^2.7"
"rector/rector": "^0.7.43",
"symplify/changelog-linker": "^8.1",
"symplify/coding-standard": "^8.1",
"symplify/easy-coding-standard-tester": "^8.1",
"symplify/phpstan-extensions": "^8.1",
"tracy/tracy": "^2.7",
"phpstan/phpdoc-parser": "0.4.4 as 0.4.8"
},
"autoload": {
"psr-4": {
Expand All @@ -31,9 +32,9 @@
},
"scripts": {
"complete-check": ["@phpstan", "@check-cs", "phpunit"],
"phpstan": "phpstan analyze src tests --error-format symplify",
"check-cs": "ecs check",
"fix-cs": "ecs check --fix",
"phpstan": "phpstan analyze src tests --error-format symplify --ansi",
"check-cs": "ecs check --ansi",
"fix-cs": "ecs check --fix --ansi",
"changelog": "changelog-linker dump-merges",
"rector": "rector process --dry-run --config rector-ci.yaml --ansi"
}
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Expand Up @@ -10,7 +10,7 @@ parameters:
- src
- tests

autoload_files:
bootstrapFiles:
- 'tests/bootstrap.php'

ignoreErrors:
Expand Down
File renamed without changes.
18 changes: 9 additions & 9 deletions tests/Sniffs/Classes/ForbiddenPublicPropertySniffTest.php
Expand Up @@ -5,18 +5,18 @@
use Iterator;
use ObjectCalisthenics\Sniffs\Classes\ForbiddenPublicPropertySniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @see ForbiddenPublicPropertySniff
*/
final class ForbiddenPublicPropertySniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideCorrectCases()
*/
public function testCorrectCases(string $file): void
{
$this->doTestCorrectFile($file);
$fileInfo = new SmartFileInfo($file);
$this->doTestFileInfo($fileInfo);
}

public function provideCorrectCases(): Iterator
Expand All @@ -27,18 +27,18 @@ public function provideCorrectCases(): Iterator
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
public function testWrongToFixed(SmartFileInfo $wrongFile): void
{
$this->doTestWrongFile($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFile, 1);
}

public function provideWrongCases(): Iterator
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return ForbiddenPublicPropertySniff::class;
}
}
20 changes: 9 additions & 11 deletions tests/Sniffs/CodeAnalysis/OneObjectOperatorPerLineSniffTest.php
Expand Up @@ -5,18 +5,18 @@
use Iterator;
use ObjectCalisthenics\Sniffs\CodeAnalysis\OneObjectOperatorPerLineSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @see OneObjectOperatorPerLineSniff
*/
final class OneObjectOperatorPerLineSniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideCorrectCases()
*/
public function testCorrectCases(string $file): void
{
$this->doTestCorrectFile($file);
$fileInfo = new SmartFileInfo($file);
$this->doTestFileInfo($fileInfo);
}

public function provideCorrectCases(): Iterator
Expand All @@ -27,20 +27,18 @@ public function provideCorrectCases(): Iterator
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
public function testWrongToFixed(SmartFileInfo $wrongFileInfo): void
{
$this->doTestWrongFile($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFileInfo, 1);
}

public function provideWrongCases(): Iterator
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
yield [__DIR__ . '/wrong/wrong2.php.inc'];
yield [__DIR__ . '/wrong/wrong3.php.inc'];
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return OneObjectOperatorPerLineSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/CodeAnalysis/config.yml

This file was deleted.

17 changes: 7 additions & 10 deletions tests/Sniffs/ControlStructures/NoElseSniffTest.php
Expand Up @@ -5,29 +5,26 @@
use Iterator;
use ObjectCalisthenics\Sniffs\ControlStructures\NoElseSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @see NoElseSniff
*/
final class NoElseSniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
public function testWrongToFixed(SmartFileInfo $wrongFileInfo): void
{
$this->doTestWrongFile($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFileInfo, 1);
}

public function provideWrongCases(): Iterator
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
yield [__DIR__ . '/wrong/wrong2.php.inc'];
yield [__DIR__ . '/wrong/wrong3.php.inc'];
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return NoElseSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/ControlStructures/config.yml

This file was deleted.

Expand Up @@ -3,27 +3,28 @@
namespace ObjectCalisthenics\Tests\Sniffs\Files\ClassTraitAndInterfaceLength;

use Iterator;
use ObjectCalisthenics\Sniffs\Files\ClassTraitAndInterfaceLengthSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\SmartFileSystem\SmartFileInfo;

final class ClassTraitAndInterfaceLengthSniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideWrongCases()
*/
public function testWrongToFixed(string $wrongFile): void
public function testWrongToFixed(SmartFileInfo $wrongFileInfo): void
{
$this->doTestWrongFile($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFileInfo, 1);
}

public function provideWrongCases(): Iterator
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
yield [__DIR__ . '/wrong/wrong2.php.inc'];
yield [__DIR__ . '/wrong/wrong3.php.inc'];
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return ClassTraitAndInterfaceLengthSniff::class;
}
}
2 changes: 0 additions & 2 deletions tests/Sniffs/Files/ClassTraitAndInterfaceLength/config.yml

This file was deleted.

20 changes: 9 additions & 11 deletions tests/Sniffs/Files/FunctionLength/FunctionLengthSniffTest.php
Expand Up @@ -5,28 +5,26 @@
use Iterator;
use ObjectCalisthenics\Sniffs\Files\FunctionLengthSniff;
use Symplify\EasyCodingStandardTester\Testing\AbstractCheckerTestCase;
use Symplify\EasyTesting\DataProvider\StaticFixtureFinder;
use Symplify\SmartFileSystem\SmartFileInfo;

/**
* @see FunctionLengthSniff
*/
final class FunctionLengthSniffTest extends AbstractCheckerTestCase
{
/**
* @dataProvider provideWrongCases()
* @dataProvider provideData()
*/
public function testWrongToFixed(string $wrongFile): void
public function test(SmartFileInfo $wrongFileInfo): void
{
$this->doTestWrongFile($wrongFile);
$this->doTestFileInfoWithErrorCountOf($wrongFileInfo, 1);
}

public function provideWrongCases(): Iterator
public function provideData(): Iterator
{
yield [__DIR__ . '/wrong/wrong.php.inc'];
yield [__DIR__ . '/wrong/wrong2.php.inc'];
return StaticFixtureFinder::yieldDirectory(__DIR__ . '/Fixture');
}

protected function provideConfig(): string
protected function getCheckerClass(): string
{
return __DIR__ . '/config.yml';
return FunctionLengthSniff::class;
}
}

0 comments on commit 64a8f99

Please sign in to comment.