Showing 24 of 43 total issues
Function ajax
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.ajax = (_event) => {
let _originalContent = null;
_event.preventDefault();
let _form = _event.target.closest('form');
Function jsonToTable
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
public function jsonToTable($data)
{
$table = '<table class="table table-responsive table-borderless">';
foreach ($data as $key => $value) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method js
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function js()
{
return <<<'JS'
let _this = this;
Method boot
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function boot()
{
// Gateway for determining if user is admin
Gate::define('admin', function ($user) {
return $user->hasRole('admin');
Method create
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function create($model, $email, $message)
{
$user = User::where('email', $email)->first();
$token = Str::uuid();
$from = auth()->user();
Method js
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function js()
{
return <<<'JS'
document.getElementById('confirmationModalConfirmButton').addEventListener('click', function (event) {
window.submitConfirmationForm(event);
Function handle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
public static function handle($request)
{
if ($request->two_factor_platform !== $request->user()->two_factor_platform) {
$request->user()->update([
'two_factor_code' => null,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method handle
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
public static function handle($request)
{
if ($request->two_factor_platform !== $request->user()->two_factor_platform) {
$request->user()->update([
'two_factor_code' => null,
Method schedule
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
protected function schedule(Schedule $schedule)
{
$schedule->command('mission-control:report')->everyFiveMinutes()
->runInBackground()
->appendOutputTo(storage_path('logs/scheduler.log'));
Method jsonToTable
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
public function jsonToTable($data)
{
$table = '<table class="table table-responsive table-borderless">';
foreach ($data as $key => $value) {
Function handle
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public function handle(Request $request, Closure $next)
{
$user = auth()->user();
if ($user->notConfirmedTwoFactor()) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function getPermissionsAttribute
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function getPermissionsAttribute($value)
{
if ($this->name === 'admin') {
$options = [];
$permissions = config('permissions', []);
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function boot
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function boot()
{
// Gateway for determining if user is admin
Gate::define('admin', function ($user) {
return $user->hasRole('admin');
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function verify
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public function verify(Request $request)
{
$user = $request->user();
if ($user->usesTwoFactor('email')) {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Avoid too many return
statements within this method. Open
return ! $user->hasCanceledSubscription();
Avoid too many return
statements within this method. Open
return false;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return true;
Avoid too many return
statements within this method. Open
return $team->members->contains($user->id);
Avoid too many return
statements within this method. Open
return $user->hasCanceledSubscription();