visavi/rotor

View on GitHub

Showing 286 of 512 total issues

File helpers.php has 1166 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

use App\Classes\{BBCode, Calendar, CloudFlare, Metrika};
use App\Models\AdminAdvert;
use App\Models\Advert;
Severity: Major
Found in app/helpers.php - About 3 days to fix

    File web.php has 762 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    <?php
    
    declare(strict_types=1);
    
    use App\Http\Controllers\Admin\AdminAdvertController;
    Severity: Major
    Found in routes/web.php - About 1 day to fix

      File UserController.php has 615 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      declare(strict_types=1);
      
      namespace App\Http\Controllers\User;
      Severity: Major
      Found in app/Http/Controllers/User/UserController.php - About 1 day to fix

        Function delete has a Cognitive Complexity of 64 (exceeds 5 allowed). Consider refactoring.
        Open

            public function delete(Request $request, Validator $validator): View|RedirectResponse
            {
                $user = getUserByLogin($request->input('user'));
        
                if (! $user) {
        Severity: Minor
        Found in app/Http/Controllers/Admin/UserController.php - About 1 day 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

        File main.js has 530 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        $(function () {
            let html = $('html');
            let currentLang = html.attr('lang');
            translate = window['translate_' + currentLang];
        
        
        Severity: Major
        Found in public/assets/js/main.js - About 1 day to fix

          Function edit has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
          Open

              public function edit(int $id, Request $request, Validator $validator)
              {
                  if (! $user = getUser()) {
                      abort(403, __('main.not_authorized'));
                  }
          Severity: Minor
          Found in app/Http/Controllers/Forum/TopicController.php - About 7 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

          File TopicController.php has 474 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          <?php
          
          declare(strict_types=1);
          
          namespace App\Http\Controllers\Forum;
          Severity: Minor
          Found in app/Http/Controllers/Forum/TopicController.php - About 7 hrs to fix

            File ArticleController.php has 472 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            <?php
            
            declare(strict_types=1);
            
            namespace App\Http\Controllers;
            Severity: Minor
            Found in app/Http/Controllers/ArticleController.php - About 7 hrs to fix

              File DownController.php has 439 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              declare(strict_types=1);
              
              namespace App\Http\Controllers\Load;
              Severity: Minor
              Found in app/Http/Controllers/Load/DownController.php - About 6 hrs to fix

                File User.php has 438 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                declare(strict_types=1);
                
                namespace App\Models;
                Severity: Minor
                Found in app/Models/User.php - About 6 hrs to fix

                  Method run has 144 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function run()
                      {
                          $data = [
                              ['name' => 'app_installed', 'value' => 0],
                              ['name' => 'addbansend', 'value' => 1],
                  Severity: Major
                  Found in database/seeders/SettingSeeder.php - About 5 hrs to fix

                    Method run has 144 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function run()
                        {
                            $data = [
                                'id'         => 1,
                                'name'       => 'Смайлы',
                    Severity: Major
                    Found in database/seeders/StickerSeeder.php - About 5 hrs to fix

                      Function create has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function create(Request $request, Validator $validator, Flood $flood): View|RedirectResponse
                          {
                              $cid = int($request->input('category'));
                      
                              if (! isAdmin() && ! setting('downupload')) {
                      Severity: Minor
                      Found in app/Http/Controllers/Load/DownController.php - About 5 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

                      File ForumController.php has 391 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      <?php
                      
                      declare(strict_types=1);
                      
                      namespace App\Http\Controllers\Admin;
                      Severity: Minor
                      Found in app/Http/Controllers/Admin/ForumController.php - About 5 hrs to fix

                        Method run has 121 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function run()
                            {
                                $data = [
                                    [
                                        'type'       => 'register',
                        Severity: Major
                        Found in database/seeders/NoticeSeeder.php - About 4 hrs to fix

                          User has 36 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class User extends BaseModel implements
                              AuthenticatableContract,
                              AuthorizableContract,
                              CanResetPasswordContract
                          {
                          Severity: Minor
                          Found in app/Models/User.php - About 4 hrs to fix

                            Method register has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function register(Request $request, Validator $validator)
                                {
                                    if (getUser()) {
                                        abort(403, __('users.already_registered'));
                                    }
                            Severity: Major
                            Found in app/Http/Controllers/User/UserController.php - About 4 hrs to fix

                              Method edit has 112 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  public function edit(Request $request, Validator $validator): View|RedirectResponse
                                  {
                                      $user = getUserByLogin($request->input('user'));
                              
                                      if (! $user) {
                              Severity: Major
                              Found in app/Http/Controllers/Admin/UserController.php - About 4 hrs to fix

                                Function register has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
                                Open

                                    public function register(Request $request, Validator $validator)
                                    {
                                        if (getUser()) {
                                            abort(403, __('users.already_registered'));
                                        }
                                Severity: Minor
                                Found in app/Http/Controllers/User/UserController.php - About 4 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

                                File AjaxController.php has 330 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                
                                declare(strict_types=1);
                                
                                namespace App\Http\Controllers;
                                Severity: Minor
                                Found in app/Http/Controllers/AjaxController.php - About 3 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language