SIWECOS / HSHS-DOMXSS-Scanner

MIT License
3 stars 1 forks source link

Laravel Linter #71

Closed Lednerb closed 5 years ago

Lednerb commented 5 years ago

This pull request includes changes and recommendations for crafting your application "The Laravel Way". Feel free to commit any additional changes to the shift-14372 branch.

Before merging, you should:

If you want help with your upgrade, check out the Shift Human Services or join the Shifty Coders Slack room to get answers to all your Laravel questions.

Lednerb commented 5 years ago

:warning: Shift found instances of string based class references. Laravel adopted the ::class static property since it became available in PHP 5.5. You should update your code to use references like App\SomeModel::class instead of strings like 'App\SomeModel'.

Lednerb commented 5 years ago

:warning: The following files reference Laravel facades through the global namespace. For example, you're referencing \DB or importing use DB. Instead import Illuminate\Support\Facades\DB and reference DB.

While global references are allowed through aliases, you should import the facade explicitly. This can improve clarity not only for developers, but static analysis used by your IDE.

Lednerb commented 5 years ago

:warning: The following controllers contain actions outside of the 7 resource actions (index, create, store, show, edit, update, destroy). For more details, review the docs or watch Cruddy by Design to see if you can rework these into resource controllers.

Lednerb commented 5 years ago

:information_source: Your Laravel application contains 59 classes and 1172 lines of code, with an average of 5.2 lines of code per method.

Most of your classes are Requests. Your Jobs contain the most lines of code (28 loc) and your Middlewares have the highest lines of code per method (8.5 loc).

Lednerb commented 5 years ago

:warning: Shift found the following config files differ from the defaults. While you are welcome to customize your configuration, you should leverage ENV variables rather than hardcode values. If you find you're adding a lot of configuration options, consider creating a domain specific config file, such as core.php. Both will make app upgrades and deployments easier.

Lednerb commented 5 years ago

:information_source: As noted, much of the code detected above can be automatically fixed using the Laravel Fixer. Save yourself time and clean up your codebase quickly with this new Shift.