sunscreem / dogpubtimemachine

An open source project to quickly show what Brewdog bars have had on tap.
https://dogpubtimemachine.com/
MIT License
4 stars 1 forks source link

Laravel Analyzer #31

Closed sunscreem closed 5 years ago

sunscreem 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-8651 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.

sunscreem commented 5 years ago

⚠ 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.

sunscreem commented 5 years ago

⚠ 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.

sunscreem commented 5 years ago

⚠ Shift found inline validation in the following controllers. Unless you require this level of control, you should use a Form Request to encapsulate this validation logic and keep your controller clean.

sunscreem commented 5 years ago

⚠ Laravel 5.2 added the env configuration option. Laravel recommends you only use env() within configuration files and use config() everywhere else.

Shift found potential uses of env() in:

sunscreem commented 5 years ago

ℹ Your Laravel application contains 38 classes and 490 lines of code, with an average of 10.72 lines of code per method.

Most of your classes are Models. Your Commands contain the most lines of code (46 loc) and your Commands have the highest lines of code per method (11.5 loc).

sunscreem commented 5 years ago

⚠ 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.

sunscreem commented 5 years ago

ℹ If you have manually upgraded your app from previous versions of Laravel, you should run the Laravel Linter to ensure your app is fully upgraded to the latest version of Laravel.