Skip to content
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

Laravel Linter #23

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

Laravel Linter #23

wants to merge 1 commit into from

Conversation

a-batts
Copy link
Owner

@a-batts a-batts commented Dec 31, 2022

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

Before merging, you need to:

  • Checkout the shift-77071 branch
  • Review all pull request comments for additional changes
  • Thoroughly test your application (no tests?, no CI?)

Much of the lint detected may be automatically fixed by running the Laravel Fixer or tasks within the Shift Workbench.

@a-batts
Copy link
Owner Author

a-batts commented Dec 31, 2022

❌ The following configuration files differ from the Laravel defaults. If you are modifying configuration values directly, consider using an environment variable instead to keep these files maintainable. You should compare your configuration files against the latest version and merge any updates.

  • config/app.php
  • config/auth.php
  • config/broadcasting.php
  • config/cache.php
  • config/database.php
  • config/filesystems.php
  • config/hashing.php
  • config/logging.php
  • config/mail.php
  • config/queue.php
  • config/services.php
  • config/session.php

@a-batts
Copy link
Owner Author

a-batts commented Dec 31, 2022

ℹ️ Starting with Laravel 8, the model property within factories may be removed when your models are stored within a conventional location such as app/Models. Unless your factory is for a model outside of this location, you may remove this property.

@a-batts
Copy link
Owner Author

a-batts commented Dec 31, 2022

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

  • app/Actions/Fortify/UpdateUserProfileInformation.php
  • app/Http/Livewire/Profile/SocialLogins.php
  • app/Models/ClassSchedule.php
  • app/Providers/AppServiceProvider.php

@a-batts
Copy link
Owner Author

a-batts commented Dec 31, 2022

⚠️ 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 may rework these into resource controllers.

  • app/Http/Controllers/Auth/AuthController.php
  • app/Http/Controllers/ClassController.php
  • app/Http/Controllers/EventController.php

@a-batts
Copy link
Owner Author

a-batts commented Dec 31, 2022

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

  • app/Http/Controllers/Auth/AuthController.php
  • app/Http/Middleware/HasAssignment.php
  • app/Http/Middleware/HasPassword.php

@a-batts
Copy link
Owner Author

a-batts commented Dec 31, 2022

⚠️ Shift found opportunities to use the built-in Blade directives like @auth in the following views:

  • resources/views/landing.blade.php
  • resources/views/layouts/guest.blade.php

@a-batts
Copy link
Owner Author

a-batts commented Dec 31, 2022

ℹ️ Shift detected your database migrations are using custom classes. Starting with Laravel 9.0, database migrations now use anonymous classes. This avoids class name collisions and streamlines migrations.

@a-batts
Copy link
Owner Author

a-batts commented Dec 31, 2022

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

@a-batts
Copy link
Owner Author

a-batts commented Dec 31, 2022

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

@sonarqubecloud
Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

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