Repository navigation
v1.8.0
Sloppy 1.8.0: routes and migrations
Agents write a lot of Laravel outside app/: routes to controller methods nobody wrote, closures in routes/web.php that are really controllers, and migrations edited after they already ran. Sloppy now reads those files, with rules written for them.
New rules
| Rule | Catches |
|---|---|
SL211 Missing Route Action |
Route::get('/orders/export', [OrderController::class, 'exportCsv']) when exportCsv() doesn't exist. Suggests the method a typo was reaching for. |
SL212 Logic In Route Closure |
A route closure that queries, writes, validates or runs long |
SL213 Destructive GET Route |
A GET routed to destroy/store/update, or with /delete in its URI |
SL214 Edited Migration |
A migration that already existed and was edited or renamed. It never re-runs where it already ran. (diff, CI, review and agent hooks) |
SL215 Irreversible Migration |
up() changes the schema, down() is missing or does nothing |
SL216 Model In Migration |
Eloquent models used inside |
SL217 Unconstrained Foreign Key |
foreignId() without constrained() |
SL211 reports only what it can prove. If a controller's package, or the controller forwards calls through __call,it stays quiet.
No extra noise
Routes files and migrations are read only by their own rules, plus the four that mean the same thing anywhere: SL103, SL107, SL112 and SL501. The size, duplication and readability rules leave them alone, because a long up() is not a god method.
Configuration
A new laravel setting names the directories. The defaultmigrations, and they also match module layouts likeModules/Billing/routes. --pathstill means exactly that path. Set either key to[]` to opt out.
Upgrading
database/migrationsis no longer excluded by default. If you publishedconfig/sloppy.phpearlier, it still excludes migrations. Remove that entry to getSL215–SL217.SL214reads git and w- If you had
routesinpaths, those files now get the routes rules instead of the general ones, so expect fewer findings there. - The CI templates and the GitHub Action install
^1.8by default.
Full changelog: v1.7.2...v1.8.0