Repository: bmitch/churn-php (php)

Issue:
Make run the default command
See: https://symfony.com/doc/current/components/console/changing_default_command.html

There are currently 2 command: `run` and `assess-complexity`, but only `run` is supposed to be used by our users.

So by making `run` the default command we could run Churn without arguments (with a proper configuration).


Discussion:

Patch:
diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml
--- a/.github/workflows/continuous-integration.yml
+++ b/.github/workflows/continuous-integration.yml
@@ -258,7 +258,7 @@ jobs:
         run: diff -u <(bin/churn -V) <(./churn.phar -V)
 
       - name: "Test Phar"
-        run: diff -u <(bin/churn run src --format=csv | sort) <(./churn.phar run src --format=csv | sort)
+        run: diff -u <(bin/churn --format=csv | sort) <(./churn.phar --format=csv | sort)
 
       - name: "Save Phar"
         uses: actions/upload-artifact@v2
diff --git a/README.md b/README.md
--- a/README.md
+++ b/README.md
@@ -43,7 +43,7 @@ If you want to install `churn-php` in Symfony project, your Symfony components v
 
 ## How to Install?
 Install via Composer:
-```
+```sh
 composer require bmitch/churn-php --dev
 ```
 
@@ -53,22 +53,25 @@ phive install churn
 ```
 
 ## How to Use?
-```
+```sh
 vendor/bin/churn run <one or more paths to source code> ...
 vendor/bin/churn run src
 vendor/bin/churn run src tests
+
+# the command name can be skipped if directoriesToScan is set in churn.yml
+vendor/bin/churn
 ```
 
 You can also use `churn-php` via [Docker](https://hub.docker.com/r/dockerizedphp/churn):
 
-```
+```sh
 docker run --rm -ti -v $PWD:/app dockerizedphp/churn run src
 ```
 
 ## How to Configure?
 You may add an optional `churn.yml` file which can be used to configure churn-php. The location of the churn.yml file can be customized using these commands:
 
-```
+```sh
 # Default: "churn.yml" 
 vendor/bin/churn run --configuration=config-dir/ <path>
 vendor/bin/churn run --configuration=my-config.yml <path>
diff --git a/bin/churn b/bin/churn
--- a/bin/churn
+++ b/bin/churn
@@ -11,5 +11,6 @@ use Symfony\Component\Console\Application;
 $version = substr(Versions::getVersion('bmitch/churn-php'), 0, -33);
 $application = new Application('churn-php', $version);
 $application->add(new AssessComplexityCommand());
-$application->add(RunCommand::newInstance());
+$application->add($run = RunCommand::newInstance());
+$application->setDefaultCommand($run->getName());
 $application->run();
diff --git a/churn.yml b/churn.yml
--- a/churn.yml
+++ b/churn.yml
@@ -1,3 +1,6 @@
 # The minimum score a file need to display in the results table.
 # Default: 0.1
 minScoreToShow: 0
+
+directoriesToScan:
+- src/


Test patch:
diff --git a/tests/Integration/Command/RunCommandTest.php b/tests/Integration/Command/RunCommandTest.php
--- a/tests/Integration/Command/RunCommandTest.php
+++ b/tests/Integration/Command/RunCommandTest.php
@@ -131,7 +131,10 @@ public function it_throws_for_invalid_configuration(): void
     public function it_throws_when_no_directory(): void
     {
         $this->expectException(InvalidArgumentException::class);
-        $this->commandTester->execute(['paths' => []]);
+        $this->commandTester->execute([
+            'paths' => [],
+            '-c' => __DIR__ . '/config/empty.yml',
+        ]);
     }
 
     /** @test */
diff --git a/tests/Integration/Command/config/empty.yml b/tests/Integration/Command/config/empty.yml
new file mode 100644