Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
Reduce the number of uncovered files (Deptrac) (#415)
Browse files Browse the repository at this point in the history
  • Loading branch information
gomzyakov authored Nov 20, 2022
1 parent 8aab520 commit 727b61f
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 25 deletions.
2 changes: 1 addition & 1 deletion app/Http/Controllers/NoteController.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

use App\Http\Requests\NoteCreateRequest;
use App\Models\Note;
use App\Services\NotesRepository;
use App\Repository\NotesRepository;
use Carbon\Carbon;
use Illuminate\Contracts\Foundation\Application;
use Illuminate\Contracts\View\Factory as ViewFactory;
Expand Down
2 changes: 1 addition & 1 deletion app/Providers/NotesRepositoryServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace App\Providers;

use App\Services\NotesRepository;
use App\Repository\NotesRepository;
use Hashids\Hashids;
use Illuminate\Support\ServiceProvider;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

namespace App\Services;
namespace App\Repository;

use App\Models\Note;
use Carbon\Carbon;
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,8 @@
"scripts": {
"phpunit": "@php ./vendor/bin/phpunit ./tests --no-coverage --color=always",
"phpstan": "@php ./vendor/bin/phpstan analyze -c ./phpstan.neon.dist --no-progress --ansi --verbose",
"deptrac": "@php ./vendor/bin/deptrac analyse --config-file=deptrac.yaml",
"deptrac-uncovered": "@php ./vendor/bin/deptrac analyse --config-file=deptrac.yaml --report-uncovered",
"deptrac": "@php ./vendor/bin/deptrac analyse --config-file=deptrac.yaml --no-cache",
"deptrac-uncovered": "@php ./vendor/bin/deptrac analyse --config-file=deptrac.yaml --no-cache --report-uncovered",
"cs-check": "@php ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php --dry-run --diff",
"cs-fix": "@php ./vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.dist.php",
"rector-check": "@php ./vendor/bin/rector process --dry-run",
Expand Down
73 changes: 53 additions & 20 deletions deptrac.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,41 +3,74 @@ deptrac:
paths:
- ./app
exclude_files:
- '#.*test.*#'
- .*test.*
layers:
-
name: Controller
- name: Controller
collectors:
-
type: className
value: .*Controller.*
-
name: Service
- type: directory
value: /app/Http/Controller/.*
- name: Request
collectors:
-
type: directory
- type: directory
value: /app/Http/Requests/.*
- name: Repository
collectors:
- type: directory
value: /app/Repository/.*
- name: Service
collectors:
- type: directory
value: /app/Services/.*
-
name: ServiceProvider
- name: ServiceProvider
collectors:
-
type: directory
- type: directory
value: /app/Providers/.*
-
name: Model
- name: Model
collectors:
-
type: directory
- type: directory
value: /app/Models/.*
# TODO Too general union -- divide by IlluminateDatabase, IlluminateSupport and ...
- name: Illuminate
collectors:
- type: classLike
value: Illuminate\\.*
- name: Hashids
collectors:
- type: classLike
value: Hashids\\Hashids
- name: Carbon
collectors:
- type: classLike
value: Carbon\\Carbon
- name: Laravel Sanctum
collectors:
- type: classLike
value: Laravel\\Sanctum\\.*
ruleset:
Controller:
- Request
- Illuminate
- Service
- Repository
- Model
- Carbon
Repository:
- Service
- Model
- Hashids
- Illuminate
- Carbon
Service:
- Repository
- Model
ServiceProvider:
- Service
# Models should not depend on other layers
Model: ~
- Repository
- Illuminate
- Hashids
Model:
- Illuminate
- Laravel Sanctum
- Carbon
Request:
- Illuminate

0 comments on commit 727b61f

Please sign in to comment.