Skip to content

Laravel Linter #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Laravel Linter #1

wants to merge 1 commit into from

Conversation

syofyanzuhad
Copy link
Owner

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

Before merging, you need to:

  • Checkout the shift-51491 branch
  • Review all pull request comments for additional changes
  • Thoroughly test your application

If you need help with your upgrade, check out the Human Shifts. You may also join the Shifty Coders Slack workspace to level-up your Laravel skills.

@syofyanzuhad
Copy link
Owner Author

syofyanzuhad commented Nov 5, 2021

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

  • app/Http/Controllers/ChatsController.php

@syofyanzuhad
Copy link
Owner Author

⚠️ Shift detected the following HTTP components accessing the authenticated user through Auth::user(). Within these components, you can access the authenticated user through the request object as well. Doing so limits your dependencies by leveraging objects already available.

  • app/Http/Controllers/ChatsController.php

@syofyanzuhad
Copy link
Owner Author

ℹ️ Laravel 8 reintroduced the app/Models folder by default. This is an optional change. Laravel and the artisan commands will automatically detect if you are using the app/Models folder or not.

If you wish to modernize your application to use the app/Models folder, you may run the Namespace Models Shift for free.

@syofyanzuhad
Copy link
Owner Author

ℹ️ Shift detected controller namespaces being set in your RouteServiceProvider. Laravel 8 began registering controllers using static class references instead of namespace prefixes and controller names.

You may automate this conversion using the Laravel Fixer or tasks within the Shift Workbench.

@syofyanzuhad
Copy link
Owner Author

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

  • config/app.php

@syofyanzuhad
Copy link
Owner Author

ℹ️ Your Laravel application contains 47 classes and 1,513 lines of code.

Most of your classes are middleware. Your controllers contain the most lines of code (289 loc) and your middleware have the highest lines of code per method (5 loc).

@syofyanzuhad
Copy link
Owner Author

ℹ️ Shift detected your application only has the default tests. You can quickly start adding tests by using the Test Generator to automatically create the model factories, test classes, and sample tests cases for your Laravel application.

@syofyanzuhad
Copy link
Owner Author

⚠️ Laravel 8 began PSR-4 autoloading for factories and seeders. Shift detected the following files are missing a namespace:

  • database/factories/UserFactory.php

@syofyanzuhad
Copy link
Owner Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants