luyadev/luya-module-cms

View on GitHub

Showing 209 of 326 total issues

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

            controller : ['$scope', '$http', function($scope, $http) {

                $scope.modules = [];
                $scope.controllers = [];
                $scope.actions = [];
Severity: Minor
Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

    Method testNavItemForPageVersions has 32 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function testNavItemForPageVersions()
        {
            $navItemFixture = $this->createCmsNavItemFixture([
                1 => [
                    'id' => 1,
    Severity: Minor
    Found in tests/src/models/NavItemPageTest.php - About 1 hr to fix

      Method testActionDeepPageCopyAsTemplateError has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function testActionDeepPageCopyAsTemplateError()
          {
              // erroring
              PermissionScope::run($this->app, function (PermissionScope $scope) {
                  $this->createAdminLangFixture();
      Severity: Minor
      Found in tests/src/admin/apis/NavControllerTest.php - About 1 hr to fix

        Method testRegisterCssAndJs has 32 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function testRegisterCssAndJs()
            {
                // Simulate already registered js
                Yii::$app->view->js = [
                    View::POS_READY => [
        Severity: Minor
        Found in tests/src/base/PhpBlockViewTest.php - About 1 hr to fix

          Method testFindWebsiteContainer has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function testFindWebsiteContainer()
              {
                  PageScope::run($this->app, function (PageScope $scope) {
                      $this->createAdminGroupFixture(1);
                      $this->createAdminUserFixture();
          Severity: Minor
          Found in tests/src/models/NavContainerTest.php - About 1 hr to fix

            Method createModule has 10 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                public function createModule($parentNavId, $navContainerId, $langId, $title, $alias, $moduleName, $description, $controllerName, $actionName, array $actionParams): array|int
            Severity: Major
            Found in src/models/Nav.php - About 1 hr to fix

              Function imageArrayUpload has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public static function imageArrayUpload(string|int|null|array $value, bool|string $applyFilter = false, $returnObject = false)
                  {
                      if (!empty($value) && is_array($value)) {
                          $data = [];
              
              
              Severity: Minor
              Found in src/helpers/BlockHelper.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

              Function getContentAsArray has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function getContentAsArray()
                  {
                      //$nav_item_page = (new \yii\db\Query())->select('*')->from('cms_nav_item_page t1')->leftJoin('cms_layout', 'cms_layout.id=t1.layout_id')->where(['t1.id' => $this->id])->one();
                      $nav_item_page = $this;
              
              
              Severity: Minor
              Found in src/models/NavItemPage.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 createRedirect has 10 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

                Function run has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function run()
                    {
                        // when the setup timestamp is not yet set, its a fresh installation, therefore skip the 1.0.0 generic block upgrade
                        // otherwise its an existing/upgrading instance which is doing the import command.
                        if (!Config::has(Config::CONFIG_SETUP_COMMAND_TIMESTAMP)) {
                Severity: Minor
                Found in src/admin/importers/BlockImporter.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

                Function actionSaveProperties has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function actionSaveProperties($navId)
                    {
                        $rows = [];
                
                        $doNotDeleteList = [];
                Severity: Minor
                Found in src/admin/apis/NavController.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

                Function createPageFromDraft has a Cognitive Complexity of 11 (exceeds 5 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: Minor
                Found in src/models/Nav.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

                Function rules has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function rules()
                    {
                        return [
                            [['json_config_values', 'json_config_cfg_values'], function ($attribute, $params) {
                                // if its not an array, the attribute is not dirty and has not to be serialized from input.
                Severity: Minor
                Found in src/models/NavItemPageBlockItem.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

                Function findOneByHostName has a Cognitive Complexity of 11 (exceeds 5 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

                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 getKeywords has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getKeywords()
                    {
                        if ($this->_keywords === null) {
                            if (empty($this->itemArray['keywords'])) {
                                $this->_keywords = [];
                Severity: Minor
                Found in src/menu/Item.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 getRowDescriber has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getRowDescriber()
                    {
                        if (!empty($this->row_id)) {
                            switch (StorageFile::cleanBaseTableName($this->table_name)) {
                                case "cms_nav":
                Severity: Minor
                Found in src/models/Log.php - About 1 hr to fix

                  Method ensureInputValues has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      protected function ensureInputValues($event)
                      {
                          // sort index fixture
                  
                          if (!$this->isNewRecord) {
                  Severity: Minor
                  Found in src/models/NavItemPageBlockItem.php - About 1 hr to fix

                    Method getConfigArray has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function getConfigArray()
                        {
                            return [
                                'id' => 'basetestcase',
                                'basePath' => dirname(__DIR__),
                    Severity: Minor
                    Found in tests/CmsConsoleTestCase.php - About 1 hr to fix

                      Method testImportLayoutAndChangeAfterwardsIssue337 has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function testImportLayoutAndChangeAfterwardsIssue337()
                          {
                              $this->createCmsLayoutFixture();
                              $controller = new ImportController('import-controller', $this->app);
                              $importer = new CmslayoutImporter($controller, $this->app->getModule('cmsadmin'));
                      Severity: Minor
                      Found in tests/src/admin/importers/CmslayoutImporterTest.php - About 1 hr to fix

                        Method actionIndex has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function actionIndex($itemId, $version = false, $date = false): \yii\web\Response|string
                            {
                                if (Yii::$app->adminuser->isGuest) {
                                    throw new ForbiddenHttpException('Unable to see the preview page, session expired or not logged in.');
                                }
                        Severity: Minor
                        Found in src/frontend/controllers/PreviewController.php - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language