GrafiteInc/Scaffold

View on GitHub

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');
Severity: Major
Found in resources/js/script-components/ajax-forms.js - About 2 hrs to fix

    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) {
    Severity: Minor
    Found in app/Models/Activity.php - About 2 hrs 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

    Method js has 48 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static function js()
        {
            return <<<'JS'
                    let _this = this;
    
    
    Severity: Minor
    Found in app/View/Components/Global/Notifications.php - About 1 hr to fix

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

        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();
        Severity: Minor
        Found in app/Services/InviteService.php - About 1 hr to fix

          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);
          Severity: Minor
          Found in app/View/Components/Global/ConfirmationModal.php - About 1 hr to fix

            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,
            Severity: Minor
            Found in app/Actions/ProcessUserTwoFactorSettings.php - About 1 hr 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

            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,
            Severity: Minor
            Found in app/Actions/ProcessUserTwoFactorSettings.php - About 1 hr to fix

              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'));
              Severity: Minor
              Found in app/Console/Kernel.php - About 1 hr to fix

                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) {
                Severity: Minor
                Found in app/Models/Activity.php - About 1 hr to fix

                  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

                  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 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

                        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

                            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
                              Severity
                              Category
                              Status
                              Source
                              Language