luyadev/luya-module-cms

View on GitHub

Showing 209 of 326 total issues

ConcretImplementationBlock has 25 functions (exceeds 20 allowed). Consider refactoring.
Open

class ConcretImplementationBlock implements BlockInterface
{
    public function onRegister()
    {
    }
Severity: Minor
Found in tests/data/blocks/ConcretImplementationBlock.php - About 2 hrs to fix

    Method testGetProperties has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testGetProperties()
        {
            PermissionScope::run($this->app, function (PermissionScope $scope) {
                $this->createAdminLangFixture();
                $this->createCmsNavItemRedirectFixture();
    Severity: Major
    Found in tests/src/admin/apis/NavControllerTest.php - About 2 hrs to fix

      Method testTeardownWithHidden has 70 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testTeardownWithHidden()
          {
              $this->createAdminGroupFixture(1);
              $this->createAdminUserFixture();
              $this->createAdminLangFixture([
      Severity: Major
      Found in tests/src/menu/ItemSqliteTest.php - About 2 hrs to fix

        Method testDescendentsMultiple has 68 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function testDescendentsMultiple()
            {
                $this->createAdminGroupFixture(1);
                $this->createAdminUserFixture();
        
        
        Severity: Major
        Found in tests/src/menu/ItemSqliteTest.php - About 2 hrs to fix

          Method createPageFromDraft has 67 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function createPageFromDraft($parentNavId, $navContainerId, $langId, $title, $alias, $description, $fromDraftNavId, $isDraft = false): bool|array
              {
                  if (!$isDraft && empty($isDraft) && !is_numeric($isDraft)) {
                      $isDraft = 0;
                  }
          Severity: Major
          Found in src/models/Nav.php - About 2 hrs to fix

            Method actionGeneric has 67 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function actionGeneric()
                {
                    if (Config::has(self::MIGRATION_CODE_100)) {
                        return $this->outputError("Command already executed. System is up-to-date.");
                    }
            Severity: Major
            Found in src/frontend/commands/UpdaterController.php - About 2 hrs to fix

              NavController has 24 functions (exceeds 20 allowed). Consider refactoring.
              Open

              class NavController extends \luya\admin\base\RestController
              {
                  private function postArg($name, $defautValue = null)
                  {
                      return Yii::$app->request->post($name, $defautValue);
              Severity: Minor
              Found in src/admin/apis/NavController.php - About 2 hrs to fix

                Function controller has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                            controller : ['$scope', '$http', '$filter', 'ServiceMenuData', 'ServiceLanguagesData', 'AdminToastService', 'ServiceCurrentWebsite', function($scope, $http, $filter, ServiceMenuData, ServiceLanguagesData, AdminToastService, ServiceCurrentWebsite) {
                
                                $scope.error = [];
                                $scope.success = false;
                
                
                Severity: Major
                Found in src/admin/resources/js/cmsadmin.js - About 2 hrs to fix

                  Function registerToAppView has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public static function registerToAppView(array $blockAssets, array $assetBundles)
                      {
                          $appView = Yii::$app->view;
                  
                          foreach ($blockAssets as $attribute => $blockAsset) {
                  Severity: Minor
                  Found in src/base/PhpBlockView.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

                  Function actionGeneric has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
                  Open

                      public function actionGeneric()
                      {
                          if (Config::has(self::MIGRATION_CODE_100)) {
                              return $this->outputError("Command already executed. System is up-to-date.");
                          }
                  Severity: Minor
                  Found in src/frontend/commands/UpdaterController.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

                  NavItemPage has 23 functions (exceeds 20 allowed). Consider refactoring.
                  Open

                  class NavItemPage extends NavItemType implements NavItemTypeInterface, ViewContextInterface
                  {
                      use CacheableTrait;
                  
                      /**
                  Severity: Minor
                  Found in src/models/NavItemPage.php - About 2 hrs to fix

                    Function comparePlaceholders has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function comparePlaceholders($array1, $array2)
                        {
                            if (!array_key_exists('placeholders', $array1) || !array_key_exists('placeholders', $array2)) {
                                return false;
                            }
                    Severity: Minor
                    Found in src/admin/importers/CmslayoutImporter.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 getBlockItem has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public static function getBlockItem(NavItemPageBlockItem $blockItem, NavItemPage $navItemPage, array $envOptions = [])
                        {
                            // if the block relation could be found, return false.
                            if (!$blockItem->block) {
                                return false;
                    Severity: Major
                    Found in src/models/NavItemPage.php - About 2 hrs to fix

                      Method actionDataBlocks has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function actionDataBlocks()
                          {
                              $favs = Yii::$app->adminuser->identity->setting->get("blockfav", []);
                              $groups = [];
                              foreach (BlockGroup::find()->with(['blocks'])->all() as $blockGroup) {
                      Severity: Major
                      Found in src/admin/apis/AdminController.php - About 2 hrs to fix

                        Method testVariationWhichIsSetAndNotDefault has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function testVariationWhichIsSetAndNotDefault()
                            {
                                $this->app->getModule('cmsadmin')->blockVariations = [
                                    TestingBlock::variations()
                                        ->add('idf', 'My Test')
                        Severity: Major
                        Found in tests/src/base/BlockVariationRegisterTest.php - About 2 hrs to fix

                          Function copyPageItem has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function copyPageItem(NavItem $targetNavItem)
                              {
                                  if ($this->nav_item_type !== self::TYPE_PAGE) {
                                      return false;
                                  }
                          Severity: Minor
                          Found in src/models/NavItem.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

                          Block has 21 functions (exceeds 20 allowed). Consider refactoring.
                          Open

                          class Block extends NgRestModel
                          {
                              private int $cachedDeletedId = 0;
                          
                              /**
                          Severity: Minor
                          Found in src/models/Block.php - About 2 hrs to fix

                            PhpBlockView has 21 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class PhpBlockView extends View
                            {
                                /**
                                 * @var boolean Is disabled by default as its already registered by global view and layout files are not used in block views.
                                 * @see https://github.com/luyadev/luya/issues/1807
                            Severity: Minor
                            Found in src/base/PhpBlockView.php - About 2 hrs to fix

                              NavItemController has 21 functions (exceeds 20 allowed). Consider refactoring.
                              Open

                              class NavItemController extends \luya\admin\base\RestController
                              {
                                  /**
                                   * @inheritdoc
                                   */
                              Severity: Minor
                              Found in src/admin/apis/NavItemController.php - About 2 hrs to fix

                                Query has 21 functions (exceeds 20 allowed). Consider refactoring.
                                Open

                                class Query extends BaseObject implements QueryOperatorFieldInterface
                                {
                                    /**
                                     * @var array An array with all available where operators.
                                     */
                                Severity: Minor
                                Found in src/menu/Query.php - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language