diff --git a/README.md b/README.md index bfbd480190..869edc6a70 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ [![Downloads total](https://img.shields.io/packagist/dt/symplify/easy-ci.svg?style=flat-square)](https://packagist.org/packages/symplify/easy-ci/stats) -Tools that make easy to setup CI. +Swiss knife in pocket of every upgrade architect! -- Check git conflicts in CI +
## Install @@ -16,23 +16,19 @@ composer require symplify/easy-ci --dev ### 1. Check your Code for Git Merge Conflicts -Do you use Git? Then merge conflicts is not what you want in your code ever to see: +Do you use Git? Then merge conflicts is not what you want in your code ever to see in pushed code: ```bash <<<<<<< HEAD -this is some content to mess with -content to append -======= -totally different content to merge later ```` -How to avoid it? Add check to your CI: +Add this command to CI to spot these: ```bash vendor/bin/easy-ci check-conflicts . ``` -The `/vendor` directory is excluded by default. +*Note: The `/vendor` directory is excluded by default.*
@@ -46,7 +42,7 @@ Have you ever forgot commented code in your code? // } ``` -Clutter no more! Add `check-commented-code` command to your CI and don't worry about it: +No more! Add this command to CI to spot these: ```bash vendor/bin/easy-ci check-commented-code @@ -55,7 +51,9 @@ vendor/bin/easy-ci check-commented-code packages --line-limit 5
-### 3. Find multiple classes in single file +### 3. Reach full PSR-4 + +#### Find multiple classes in single file To make PSR-4 work properly, each class must be in its own file. This command makes it easy to spot multiple classes in single file: @@ -65,7 +63,7 @@ vendor/bin/easy-ci find-multi-classes src
-### 4. Update Namespace to match PSR-4 Root +#### Update Namespace to match PSR-4 Root Is your class in wrong namespace? Make it match your PSR-4 root: diff --git a/build/rector-downgrade-php-72.php b/build/rector-downgrade-php-72.php index 5f8802617d..68641a4596 100644 --- a/build/rector-downgrade-php-72.php +++ b/build/rector-downgrade-php-72.php @@ -11,6 +11,5 @@ $rectorConfig->skip([ '*/Tests/*', '*/tests/*', - __DIR__ . '/../../tests', ]); }; diff --git a/build/target-repository/composer.json b/build/target-repository/composer.json index e146de74b5..2f5b3d6423 100644 --- a/build/target-repository/composer.json +++ b/build/target-repository/composer.json @@ -1,6 +1,6 @@ { "name": "symplify/easy-ci", - "description": "Toolkit of commands that should not be missed in you CI", + "description": "Swiss knife in pocket of every upgrade architect", "license": "MIT", "require": { "php": ">=7.2" diff --git a/composer.json b/composer.json index c7dc83b461..99738b1e03 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "symplify/easy-ci", - "description": "Toolkit of commands that should not be missed in you CI", + "description": "Swiss knife in pocket of every upgrade architect", "license": "MIT", "bin": [ "bin/easy-ci" diff --git a/src/Command/DumpEditorconfigCommand.php b/src/Command/DumpEditorconfigCommand.php new file mode 100644 index 0000000000..88f937ffc1 --- /dev/null +++ b/src/Command/DumpEditorconfigCommand.php @@ -0,0 +1,40 @@ +setName('dump-editorconfig'); + $this->setDescription('Dump .editorconfig file to project root'); + } + + protected function execute(InputInterface $input, OutputInterface $output): int + { + $projectEditorconfigFilePath = getcwd() . '/.editorconfig'; + if (file_exists($projectEditorconfigFilePath)) { + $this->symfonyStyle->error('.editorconfig file already exists'); + return self::FAILURE; + } + + FileSystem::copy(__DIR__ . '/../../templates/.editorconfig', $projectEditorconfigFilePath); + $this->symfonyStyle->success('.editorconfig file was created'); + + return self::SUCCESS; + } +} diff --git a/src/DependencyInjection/ContainerFactory.php b/src/DependencyInjection/ContainerFactory.php index 2a2a0a697a..29513891c3 100644 --- a/src/DependencyInjection/ContainerFactory.php +++ b/src/DependencyInjection/ContainerFactory.php @@ -11,6 +11,7 @@ use Symfony\Component\Console\Style\SymfonyStyle; use Symplify\EasyCI\Command\CheckCommentedCodeCommand; use Symplify\EasyCI\Command\CheckConflictsCommand; +use Symplify\EasyCI\Command\DumpEditorconfigCommand; use Symplify\EasyCI\Command\FindMultiClassesCommand; use Symplify\EasyCI\Command\NamespaceToPSR4Command; use Symplify\EasyCI\Command\ValidateFileLengthCommand; @@ -26,11 +27,6 @@ public function create(): Container $container = new Container(); // console - $container->singleton( - SymfonyStyle::class, - static fn (): SymfonyStyle => new SymfonyStyle(new ArrayInput([]), new ConsoleOutput()) - ); - $container->singleton(Application::class, function (Container $container): Application { $application = new Application('Easy CI toolkit'); @@ -41,6 +37,7 @@ public function create(): Container $container->make(DetectUnitTestsCommand::class), $container->make(FindMultiClassesCommand::class), $container->make(NamespaceToPSR4Command::class), + $container->make(DumpEditorconfigCommand::class), ]; $application->addCommands($commands); @@ -51,6 +48,11 @@ public function create(): Container return $application; }); + $container->singleton( + SymfonyStyle::class, + static fn (): SymfonyStyle => new SymfonyStyle(new ArrayInput([]), new ConsoleOutput()) + ); + return $container; } diff --git a/src/Testing/Command/DetectUnitTestsCommand.php b/src/Testing/Command/DetectUnitTestsCommand.php index 8a7b8f39d3..a760ee385e 100644 --- a/src/Testing/Command/DetectUnitTestsCommand.php +++ b/src/Testing/Command/DetectUnitTestsCommand.php @@ -34,8 +34,7 @@ protected function configure(): void { $this->setName('detect-unit-tests'); - $this->setDescription('Get list of tests in specific directory, that are considered "unit". -They depend only on bare PHPUnit test case, but not on KernelTestCase. Move the generated file to your phpunit.xml test group.'); + $this->setDescription('Get list of tests in specific directory, that are considered "unit"'); $this->addArgument( Option::SOURCES, diff --git a/templates/.editorconfig b/templates/.editorconfig new file mode 100644 index 0000000000..bec95c4494 --- /dev/null +++ b/templates/.editorconfig @@ -0,0 +1,9 @@ +root = true + +[*] +charset = utf-8 +end_of_line = lf +insert_final_newline = true +trim_trailing_whitespace = true +indent_style = space +indent_size = 4