luyadev/luya-module-cms

View on GitHub

Showing 209 of 326 total issues

File _dataFrArray.php has 1431 lines of code (exceeds 250 allowed). Consider refactoring.
Open

<?php

return
    [
            43 =>
Severity: Major
Found in tests/src/menu/_dataFrArray.php - About 3 days to fix

    File cmsadmin.js has 1405 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    (function() {
        "use strict";
        
        // directive.js
    
    
    Severity: Major
    Found in src/admin/resources/js/cmsadmin.js - About 3 days to fix

      Function renderPlaceholderRecursive has a Cognitive Complexity of 67 (exceeds 5 allowed). Consider refactoring.
      Open

          private function renderPlaceholderRecursive($navItemPageId, $placeholderVar, $prevId, $layoutBlockInstance = null)
          {
              $string = '';
              $i = 0;
              $equalIndex = 1;
      Severity: Minor
      Found in src/models/NavItemPage.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 Nav.php has 595 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace luya\cms\models;
      
      use luya\admin\models\Group;
      Severity: Major
      Found in src/models/Nav.php - About 1 day to fix

        Item has 52 functions (exceeds 20 allowed). Consider refactoring.
        Open

        class Item extends BaseObject implements LinkInterface, Arrayable
        {
            use LinkTrait;
            use ArrayableTrait;
        
        
        Severity: Major
        Found in src/menu/Item.php - About 7 hrs to fix

          InternalBaseBlock has 48 functions (exceeds 20 allowed). Consider refactoring.
          Open

          abstract class InternalBaseBlock extends BaseObject implements BlockInterface, TypesInterface, \ArrayAccess
          {
              /**
               * @var string Defines the injector config type `var`.
               */
          Severity: Minor
          Found in src/base/InternalBaseBlock.php - About 6 hrs to fix

            Method testEnvOptionsPlaceholderIteration has 146 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function testEnvOptionsPlaceholderIteration()
                {
                    $this->app->setComponents([
                        'db' => [
                            'class' => 'yii\db\Connection',
            Severity: Major
            Found in tests/src/base/BlockPlaceholderIterationTest.php - About 5 hrs to fix

              File NavController.php has 376 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              namespace luya\cms\admin\apis;
              
              use luya\admin\models\TagRelation;
              Severity: Minor
              Found in src/admin/apis/NavController.php - About 5 hrs to fix

                File NavItemController.php has 372 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                
                namespace luya\cms\admin\apis;
                
                use luya\cms\admin\Module;
                Severity: Minor
                Found in src/admin/apis/NavItemController.php - About 4 hrs to fix

                  File NavItemPage.php has 370 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  <?php
                  
                  namespace luya\cms\models;
                  
                  use luya\cms\admin\Module;
                  Severity: Minor
                  Found in src/models/NavItemPage.php - About 4 hrs to fix

                    File Item.php has 358 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    <?php
                    
                    namespace luya\cms\menu;
                    
                    use luya\admin\models\User;
                    Severity: Minor
                    Found in src/menu/Item.php - About 4 hrs to fix

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

                          public function testRenderToolbar()
                          {
                              //region Fictures
                      
                              $adminGroupFixture = new ActiveRecordFixture([
                      Severity: Major
                      Found in tests/src/controllers/DefaultControllerTest.php - About 4 hrs to fix

                        File BlockController.php has 352 lines of code (exceeds 250 allowed). Consider refactoring.
                        Open

                        <?php
                        
                        namespace luya\cms\frontend\commands;
                        
                        use luya\cms\models\Block;
                        Severity: Minor
                        Found in src/frontend/commands/BlockController.php - About 4 hrs to fix

                          Nav has 34 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Nav extends ActiveRecord
                          {
                              use TaggableTrait;
                          
                              /**
                          Severity: Minor
                          Found in src/models/Nav.php - About 4 hrs to fix

                            Function actionUpdatePageItem has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
                            Open

                                public function actionUpdatePageItem($navItemId, $navItemType): array|bool
                                {
                                    $model = NavItem::findOne($navItemId);
                            
                                    if (!$model) {
                            Severity: Minor
                            Found in src/admin/apis/NavItemController.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

                            Method actionUpdatePageItem has 105 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function actionUpdatePageItem($navItemId, $navItemType): array|bool
                                {
                                    $model = NavItem::findOne($navItemId);
                            
                                    if (!$model) {
                            Severity: Major
                            Found in src/admin/apis/NavItemController.php - About 4 hrs to fix

                              Menu has 33 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class Menu extends Component implements \ArrayAccess, QueryOperatorFieldInterface
                              {
                                  use CacheableTrait;
                              
                                  /**
                              Severity: Minor
                              Found in src/Menu.php - About 4 hrs to fix

                                File Menu.php has 336 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                <?php
                                
                                namespace luya\cms;
                                
                                use luya\cms\menu\InjectItemInterface;
                                Severity: Minor
                                Found in src/Menu.php - About 4 hrs to fix

                                  Method afterSetup has 99 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                      public function afterSetup()
                                      {
                                          parent::afterSetup();
                                  
                                          $this->createAdminUserFixture([
                                  Severity: Major
                                  Found in tests/src/admin/apis/MenuControllerTest.php - About 3 hrs to fix

                                    File NavControllerTest.php has 331 lines of code (exceeds 250 allowed). Consider refactoring.
                                    Open

                                    <?php
                                    
                                    namespace cmstests\src\admin\apis;
                                    
                                    use cmstests\WebModelTestCase;
                                    Severity: Minor
                                    Found in tests/src/admin/apis/NavControllerTest.php - About 3 hrs to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language