luyadev/luya-module-cms

View on GitHub

Showing 209 of 326 total issues

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

            controller : ['$scope', 'ServiceLayoutsData', 'ServiceMenuData', function($scope, ServiceLayoutsData, ServiceMenuData) {

                $scope.data.use_draft = 0;
                $scope.data.layout_id = 0;
                $scope.data.from_draft_id = 0;
Severity: Minor
Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

    Method createRedirectItem has 26 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function createRedirectItem($navId, $langId, $title, $alias, $redirectType, $redirectTypeValue, $description, $redirectTypeTarget): array|int
        {
            $_errors = [];
    
            $navItem = new NavItem();
    Severity: Minor
    Found in src/models/Nav.php - About 1 hr to fix

      Method findOneByHostName has 26 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function findOneByHostName($hostName): array|bool
          {
              $cache = $this->getHasCache($hostName);
              if ($cache) {
                  return $cache;
      Severity: Minor
      Found in src/Website.php - About 1 hr to fix

        Method createModuleItem has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function createModuleItem($navId, $langId, $title, $alias, $moduleName, $description, $controllerName, $actionName, array $actionParams): array|int
            {
                $_errors = [];
        
                $navItem = new NavItem();
        Severity: Minor
        Found in src/models/Nav.php - About 1 hr to fix

          Method testBasicBlockImporter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testBasicBlockImporter()
              {
                  // config fixture
                  $configFixture = new ActiveRecordFixture([
                      'modelClass' => Config::class
          Severity: Minor
          Found in tests/src/admin/importers/BlockImporterTest.php - About 1 hr to fix

            Method createPage has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function createPage($parentNavId, $navContainerId, $langId, $title, $alias, $layoutId, $description, $isDraft = false): array|int
            Severity: Major
            Found in src/models/Nav.php - About 1 hr to fix

              Method createPageFromDraft has 8 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  public function createPageFromDraft($parentNavId, $navContainerId, $langId, $title, $alias, $description, $fromDraftNavId, $isDraft = false): bool|array
              Severity: Major
              Found in src/models/Nav.php - About 1 hr to fix

                Method createRedirectItem has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    public function createRedirectItem($navId, $langId, $title, $alias, $redirectType, $redirectTypeValue, $description, $redirectTypeTarget): array|int
                Severity: Major
                Found in src/models/Nav.php - About 1 hr to fix

                  Function loadWebsiteLanguageContainer has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      private function loadWebsiteLanguageContainer($langShortCode)
                      {
                          $hostName = $this->request->hostName;
                          $cacheKey = $this->_cachePrefix.$hostName.$langShortCode;
                  
                  
                  Severity: Minor
                  Found in src/Menu.php - About 55 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 handleLayoutFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      protected function handleLayoutFile(&$layoutFiles, $path, $themeName = null)
                      {
                          $aliased = Yii::getAlias($path, false);
                          $filePath = $aliased ?: $path;
                  
                  
                  Severity: Minor
                  Found in src/admin/importers/CmslayoutImporter.php - About 55 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 controller has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                              controller : ['$scope', '$http', '$filter', 'ServiceMenuData', 'ServiceLanguagesData', 'AdminToastService', 'ServiceCurrentWebsite', function($scope, $http, $filter, ServiceMenuData, ServiceLanguagesData, AdminToastService, ServiceCurrentWebsite) {
                  Severity: Major
                  Found in src/admin/resources/js/cmsadmin.js - About 50 mins to fix

                    Function actionCatch has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        public function actionCatch($path)
                        {
                            $compositePath = Yii::$app->composition->prependTo($path);
                            foreach (Redirect::find()->all() as $redirect) {
                                if ($redirect->matchRequestPath($path)) {
                    Severity: Minor
                    Found in src/admin/apis/RedirectController.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 handleBlockDefintionInDirectories has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function handleBlockDefintionInDirectories(array $directories, $blockDefinition)
                        {
                            $results = [];
                            foreach ($directories as $directoryPath) {
                                $path = rtrim((string) $directoryPath, DIRECTORY_SEPARATOR) . DIRECTORY_SEPARATOR . ltrim((string) $blockDefinition, DIRECTORY_SEPARATOR);
                    Severity: Minor
                    Found in src/admin/importers/BlockImporter.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 findInternalRedirect has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Open

                        protected function findInternalRedirect()
                        {
                            $path = Yii::$app->request->pathInfo;
                            $compositePath = Yii::$app->composition->prependTo($path);
                            foreach (Redirect::find()->all() as $redirect) {
                    Severity: Minor
                    Found in src/frontend/controllers/DefaultController.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 getBlockItem has a Cognitive Complexity of 8 (exceeds 5 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: Minor
                    Found in src/models/NavItemPage.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

                    Method createPageItem has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                        public function createPageItem($navId, $langId, $title, $alias, $layoutId, $description): array|int
                    Severity: Minor
                    Found in src/models/Nav.php - About 45 mins to fix

                      Function actionIndex has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionIndex()
                          {
                              try {
                                  $current = Yii::$app->menu->current;
                              } catch (Exception $e) {
                      Severity: Minor
                      Found in src/frontend/controllers/DefaultController.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 actionDeepPageCopy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionDeepPageCopy()
                          {
                              $navId = (int) Yii::$app->request->getBodyParam('navId');
                      
                              if (empty($navId)) {
                      Severity: Minor
                      Found in src/admin/apis/NavController.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 actionCreatePageVersion has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionCreatePageVersion()
                          {
                              $fromPageModel = null;
                              $name = Yii::$app->request->post('name');
                              $fromPageId = (int) Yii::$app->request->post('fromPageId');
                      Severity: Minor
                      Found in src/admin/apis/NavItemController.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

                      Avoid deeply nested control flow statements.
                      Open

                                              if ($parentNavId) {
                                                  $data = $node->title . '/' . $data;
                                              }
                      Severity: Major
                      Found in src/admin/apis/NavItemController.php - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language