Skip to content

Commit

Permalink
perf: #13 argument files optional
Browse files Browse the repository at this point in the history
  • Loading branch information
shaunthegeek committed Oct 31, 2021
1 parent aec612f commit 03eba5e
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
15 changes: 8 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,20 +16,21 @@ composer require --dev laravel-fans/lint
php artisan lint:publish
```

## use
## usage

lint code:
### lint code

```shell
php artisan lint:check .
php artisan lint:check app/ tests/
php artisan lint:check --standard=Squiz app/
php artisan lint:code
php artisan lint:code --fix
php artisan lint:code app/ tests/
php artisan lint:code --standard=Squiz app/
php artisan lint:staged
```

The default standard is PSR-12, feel free to change the `phpcs.xml`.
The default standard is `phpcs.xml`, feel free to change it.

lint route URL:
### lint route URI

```shell
php artisan lint:route
Expand Down
6 changes: 4 additions & 2 deletions src/LintCodeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ class LintCodeCommand extends Command
* @var string
*/
protected $signature = 'lint:code
{files*}
{files?*}
{--fix : automatic fix}
{--standard=phpcs.xml : coding standards}';

Expand All @@ -33,9 +33,11 @@ class LintCodeCommand extends Command
public function handle()
{
$bin = $this->option('fix') ? 'phpcbf' : 'phpcs';
$files = empty($this->argument('files')) ? [ '.' ] : $this->argument('files');

exec(
"vendor/bin/$bin --standard=" . $this->option('standard')
. ' ' . implode(' ', $this->argument('files')),
. ' ' . implode(' ', $files),
$output,
$code
);
Expand Down

0 comments on commit 03eba5e

Please sign in to comment.