luyadev/luya-module-cms

View on GitHub

Showing 209 of 326 total issues

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

    public function testMatchRequestPath()
    {
        $fixture = new NgRestModelFixture([
            'modelClass' => Redirect::class
        ]);
Severity: Minor
Found in tests/src/models/RedirectTest.php - About 1 hr to fix

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

        private function buildList(QueryIteratorFilter $iterator, $i = 1)
        {
            // Abort if maxDepth is set & reached
            if ($this->maxDepth !== null && $i >= ($this->maxDepth + 1)) {
                return "";
    Severity: Minor
    Found in src/widgets/NavTree.php - About 1 hr to fix

      Function dropItemPlaceholder has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              $scope.dropItemPlaceholder = function(dragged,dropped,position) {
                  if (dragged.hasOwnProperty('favorized') || dragged.hasOwnProperty('newblock')) {
                      // its a new block
                      $http.post('admin/api-cms-navitempageblockitem/create', {
                          prev_id : dropped.prev_id,
      Severity: Minor
      Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

        Method actionDelete has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function actionDelete($navId)
            {
                if (!Yii::$app->adminuser->canRoute(Module::ROUTE_PAGE_DELETE)) {
                    throw new ForbiddenHttpException("Unable to remove this page due to permission restrictions.");
                }
        Severity: Minor
        Found in src/admin/apis/NavController.php - About 1 hr to fix

          Function dropItemPlaceholder has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  $scope.dropItemPlaceholder = function(dragged,dropped,position) {
                      if (dragged.hasOwnProperty('favorized') || dragged.hasOwnProperty('newblock')) {
                          // its a new block
                          $http.post('admin/api-cms-navitempageblockitem/create', {
                              prev_id: dropped.prev_id, 
          Severity: Minor
          Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

            Method testFindByTags has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

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

              Method createModuleItem has 9 arguments (exceeds 4 allowed). Consider refactoring.
              Open

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

                Method actionSaveProperties has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function actionSaveProperties($navId)
                    {
                        $rows = [];
                
                        $doNotDeleteList = [];
                Severity: Minor
                Found in src/admin/apis/NavController.php - About 1 hr to fix

                  Method testActionTags has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function testActionTags()
                      {
                          PermissionScope::run($this->app, function (PermissionScope $scope) {
                              $scope->createAndAllowRoute('webmodel/nav/tags');
                              $scope->createAndAllowRoute('webmodel/nav/save-tags');
                  Severity: Minor
                  Found in tests/src/admin/apis/NavControllerTest.php - About 1 hr to fix

                    Method generateItems has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        private function generateItems($start, $end, $lang)
                        {
                            $data = [];
                            foreach (range($start, $end) as $number) {
                                $data[$number] = [
                    Severity: Minor
                    Found in tests/src/menu/QueryTest.php - About 1 hr to fix

                      Function renderToolbar has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function renderToolbar($event)
                          {
                              Yii::info('LUYA CMS Toolbar rendering start', __METHOD__);
                      
                              $props = [];
                      Severity: Minor
                      Found in src/frontend/base/Controller.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 createHostInfoMapping has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function createHostInfoMapping()
                          {
                              $hostInfoMapping = [];
                      
                              foreach ($this->loadAllWebsiteData() as $website) {
                      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 luyaBootstrap has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function luyaBootstrap(Application $app)
                          {
                              if (!$app->request->isConsoleRequest && !$app->request->isAdmin) {
                                  if ($app->has('composition') && $app->has('website')) {
                                      if (empty($app->composition->hostInfoMapping)) {
                      Severity: Minor
                      Found in src/frontend/Module.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 imageUpload has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function imageUpload(string|int|null $value, bool|string $applyFilter = false, $returnObject = false): bool|array|\luya\admin\image\Item
                          {
                              if (empty($value)) {
                                  return false;
                              }
                      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 controller has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                                  controller : ['$scope', '$http', function($scope, $http) {
                      
                                      $scope.parent = $scope.$parent.$parent;
                                      $scope.navItemId = $scope.parent.item.id;
                      
                      
                      Severity: Minor
                      Found in src/admin/resources/js/cmsadmin.js - About 1 hr to fix

                        Method getItems has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            private function getItems(NavContainer $container, $parentNavId = 0, $parentGroup = [], $index = 1)
                            {
                                $navs = $container->getNavs()->andWhere(['parent_nav_id' => $parentNavId])->all();
                        
                                foreach ($navs as $nav) {
                        Severity: Minor
                        Found in src/admin/apis/MenuController.php - About 1 hr to fix

                          Method run has 27 lines of code (exceeds 25 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

                            Method testBlockEnvOptions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                public function testBlockEnvOptions()
                                {
                                    $block = new TestBlock();
                                    $pageObject = new ActiveRecord(); // @TODO specify class
                            
                            
                            Severity: Minor
                            Found in tests/src/base/BlockTest.php - About 1 hr to fix

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

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

                                Method testItemFunctions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                    public function testItemFunctions()
                                    {
                                        $obj = Yii::$app->menu->findOne(['id' => 1]);
                                
                                        $this->assertEquals(1, $obj->id);
                                Severity: Minor
                                Found in tests/src/menu/ItemTest.php - About 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language