diff --git a/composer-root-version-checker/Makefile b/composer-root-version-checker/Makefile index 94ca7f49..126caf8c 100644 --- a/composer-root-version-checker/Makefile +++ b/composer-root-version-checker/Makefile @@ -9,6 +9,9 @@ MAKEFLAGS += --no-builtin-rules PHPUNIT_BIN = vendor/bin/phpunit PHPUNIT = $(PHPUNIT_BIN) +RECTOR_BIN = ../vendor-bin/rector/vendor/bin/rector +RECTOR = $(RECTOR_BIN) --config=rector.php + .PHONY: help help: @@ -17,7 +20,7 @@ help: .PHONY: check -check: cs cs_lint check_root_version phpunit +check: rector cs autoreview check_root_version phpunit .PHONY: check_root_version @@ -32,6 +35,11 @@ dump_root_version: vendor @./bin/dump +.PHONY: autoreview +autoreview: ## Runs the AutoReview checks +autoreview: cs_lint rector_lint + + .PHONY: cs cs: ## Runs the fixers cs: gitignore_sort composer_normalize php_cs_fixer @@ -75,6 +83,14 @@ php_cs_fixer_lint: phpunit: $(PHPUNIT_BIN) vendor $(PHPUNIT) +.PHONY: rector +rector: $(RECTOR_BIN) + $(RECTOR) + +.PHONY: rector_lint +rector_lint: $(RECTOR_BIN) + $(RECTOR) --dry-run + vendor: composer.lock composer install touch -c $@ @@ -86,3 +102,6 @@ composer.lock: composer.json $(PHPUNIT_BIN): vendor touch -c $@ + +$(RECTOR_BIN): + cd ..; $(MAKE) --makefile Makefile $@ diff --git a/composer-root-version-checker/rector.php b/composer-root-version-checker/rector.php new file mode 100644 index 00000000..8e657684 --- /dev/null +++ b/composer-root-version-checker/rector.php @@ -0,0 +1,39 @@ +, + * Pádraic Brady + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +use Rector\Config\RectorConfig; +use Rector\PHPUnit\Set\PHPUnitSetList; +use Rector\Set\ValueObject\LevelSetList; + +return static function (RectorConfig $rectorConfig): void { + $rectorConfig->paths([ + __DIR__.'/bin', + __DIR__.'/src', + __DIR__.'/tests', + ]); + + $rectorConfig->autoloadPaths([ + __DIR__.'/vendor/autoload.php', + __DIR__.'/../vendor-bin/rector/vendor/autoload.php', + ]); + + $rectorConfig->importNames(); + + $rectorConfig->sets([ + LevelSetList::UP_TO_PHP_81, + LevelSetList::UP_TO_PHP_82, + + PHPUnitSetList::PHPUNIT_90, + ]); +}; diff --git a/composer-root-version-checker/tests/MakefileTest.php b/composer-root-version-checker/tests/MakefileTest.php index aeaa393e..8d4eb02a 100644 --- a/composer-root-version-checker/tests/MakefileTest.php +++ b/composer-root-version-checker/tests/MakefileTest.php @@ -40,6 +40,7 @@ protected function getExpectedHelpOutput(): string check_root_version: Checks that the Composer root version is up to date dump_root_version: Dumps the latest Composer root version + autoreview: Runs the AutoReview checks cs: Runs the fixers cs_lint: Runs the linters test: Runs the tests