GrafiteInc/Scaffold

View on GitHub

Showing 43 of 43 total issues

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()) {
Severity: Minor
Found in app/Http/Middleware/TwoFactor.php - About 45 mins to fix

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', []);
Severity: Minor
Found in app/Models/Role.php - About 35 mins to fix

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');
Severity: Minor
Found in app/Providers/AuthServiceProvider.php - About 35 mins to fix

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')) {
Severity: Minor
Found in app/Http/Controllers/Auth/TwoFactorController.php - About 35 mins to fix

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

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Severity: Minor
Found in database/migrations/2020_08_02_175621_add_avatar_to_teams.php and 2 other locations - About 30 mins to fix
database/migrations/2019_08_01_070137_add_avatar_to_users.php on lines 1..32
database/migrations/2020_03_29_031809_add_billing_email_to_users.php on lines 1..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 91.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
database/migrations/2019_08_01_070137_add_avatar_to_users.php on lines 1..32
database/migrations/2020_08_02_175621_add_avatar_to_teams.php on lines 1..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 91.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
Severity: Minor
Found in database/migrations/2019_08_01_070137_add_avatar_to_users.php and 2 other locations - About 30 mins to fix
database/migrations/2020_03_29_031809_add_billing_email_to_users.php on lines 1..32
database/migrations/2020_08_02_175621_add_avatar_to_teams.php on lines 1..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 91.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

class AddUuidToTeams extends Migration
{
    /**
     * Run the migrations.
     *
Severity: Minor
Found in database/migrations/2020_02_03_041705_add_uuid_to_teams.php and 1 other location - About 30 mins to fix
database/migrations/2023_03_07_120911_sanctum_upgrade.php on lines 7..28

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

return new class extends Migration
{
    /**
     * Run the migrations.
     */
Severity: Minor
Found in database/migrations/2023_03_07_120911_sanctum_upgrade.php and 1 other location - About 30 mins to fix
database/migrations/2020_02_03_041705_add_uuid_to_teams.php on lines 7..32

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 90.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Avoid too many return statements within this method.
Open

            return ! $user->hasCanceledSubscription();
Severity: Major
Found in app/Providers/AuthServiceProvider.php - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

                return $user->hasCanceledSubscription();
    Severity: Major
    Found in app/Providers/AuthServiceProvider.php - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                      return true;
      Severity: Major
      Found in app/Providers/AuthServiceProvider.php - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                    return $team->members->contains($user->id);
        Severity: Major
        Found in app/Providers/AuthServiceProvider.php - About 30 mins to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

                      if (! document.querySelector('.sidebar').classList.contains('toggled')) {
                          document.querySelector('main').removeEventListener('wheel', _sidebarPreventScroll, { passive: false });
                          window.app.pullToRefresh();
                      }
          Severity: Minor
          Found in resources/js/script-components/sidebar.js and 1 other location - About 30 mins to fix
          resources/js/script-components/sidebar.js on lines 14..17

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 45.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Avoid too many return statements within this method.
          Open

                      return $user->hasActiveSubscription() || $user->onTrial() || $user->hasRole('admin');
          Severity: Major
          Found in app/Providers/AuthServiceProvider.php - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                            return true;
            Severity: Major
            Found in app/Providers/AuthServiceProvider.php - About 30 mins to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  generalChannel.listen('.general-event', (data) => {
                      window.app.notify.info(data.data.message);
                  });
              Severity: Minor
              Found in resources/js/script-components/echo-events.js and 1 other location - About 30 mins to fix
              resources/js/script-components/echo-events.js on lines 12..14

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

                  userChannel.listen('.user-event', (data) => {
                      window.app.notify.info(data.data.message);
                  });
              Severity: Minor
              Found in resources/js/script-components/echo-events.js and 1 other location - About 30 mins to fix
              resources/js/script-components/echo-events.js on lines 6..8

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 45.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Avoid too many return statements within this method.
              Open

                          return false;
              Severity: Major
              Found in app/Providers/AuthServiceProvider.php - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                                return true;
                Severity: Major
                Found in app/Providers/AuthServiceProvider.php - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language