stefanzweifel / screeenly

📸 Screenshot as a Service
https://secure.screeenly.com
MIT License
503 stars 103 forks source link

Laravel Analyzer #151

Closed stefanzweifel closed 6 years ago

stefanzweifel commented 6 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-8235 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.

stefanzweifel commented 6 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.

stefanzweifel commented 6 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.

stefanzweifel commented 6 years ago

âš  Shift found opportunities to use the built-in Blade directives like @csrf, @json in the following views:

stefanzweifel commented 6 years ago

ℹ Your Laravel application contains 69 classes and 688 lines of code, with an average of 2.72 lines of code per method.

Most of your classes are Controllers. Your Controllers contain the most lines of code (126 loc) and your Controllers have the highest lines of code per method (5.04 loc).

stefanzweifel commented 6 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.

stefanzweifel commented 6 years ago

ℹ Shift noticed you have additional namespaces in your project. You should consider using the Consolidate Namespaces Shift to simplify your namespaces into the default Laravel App namespace.

stefanzweifel commented 6 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.