luyadev/luya-module-cms

View on GitHub

Showing 326 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

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  return $q(function(resolve, reject) {
      
                      if ($scope.data.nav_item_type == 1) {
                          $http.post('admin/api-cms-nav/create-page', $.param($scope.data), headers).then(function(response) {
                              resolve(response.data);
      Severity: Major
      Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 day to fix
      src/admin/resources/js/cmsadmin.js on lines 845..870

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 275.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

                  return $q(function(resolve, reject) {
      
                      if ($scope.data.nav_item_type == 1) {
                          $http.post('admin/api-cms-nav/create-page-item', $.param($scope.data), headers).then(function(response) {
                              resolve(response.data);
      Severity: Major
      Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 1 day to fix
      src/admin/resources/js/cmsadmin.js on lines 802..827

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 275.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        zaa.factory("ServiceLayoutsData", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {
            var service = [];
            
            service.data = [];
            
        Severity: Major
        Found in src/admin/resources/js/services.js and 2 other locations - About 7 hrs to fix
        src/admin/resources/js/services.js on lines 78..98
        src/admin/resources/js/services.js on lines 115..135

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 192.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        zaa.factory("ServiceBlocksData", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {
            var service = [];
            
            service.data = [];
            
        Severity: Major
        Found in src/admin/resources/js/services.js and 2 other locations - About 7 hrs to fix
        src/admin/resources/js/services.js on lines 78..98
        src/admin/resources/js/services.js on lines 151..171

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 192.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

        zaa.factory("ServiceMenuData", ['$http', '$q', '$rootScope', function($http, $q, $rootScope) {
            var service = [];
            
            service.data = [];
            
        Severity: Major
        Found in src/admin/resources/js/services.js and 2 other locations - About 7 hrs to fix
        src/admin/resources/js/services.js on lines 115..135
        src/admin/resources/js/services.js on lines 151..171

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 192.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                        $scope.$watch(function() { return $scope.navData.is_hidden }, function(n, o) {
                            if (n !== o && n !== undefined) {
                                $http.get('admin/api-cms-nav/toggle-hidden', { params : { navId : $scope.navData.id , hiddenStatus : n }}).then(function(response) {
                                    if ($scope.navData.is_hidden == 1) {
                                        AdminToastService.info(i18nParam('js_state_hidden', {title: $scope.navData.title}));
        Severity: Major
        Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 7 hrs to fix
        src/admin/resources/js/cmsadmin.js on lines 1095..1105

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 187.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

                        $scope.$watch(function() { return $scope.navData.is_offline }, function(n, o) {
                            if (n !== o && n !== undefined) {
                                $http.get('admin/api-cms-nav/toggle-offline', { params : { navId : $scope.navData.id , offlineStatus : n }}).then(function(response) {
                                    if ($scope.navData.is_offline == 1) {
                                        AdminToastService.info(i18nParam('js_state_offline', {title: $scope.navData.title}));
        Severity: Major
        Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 7 hrs to fix
        src/admin/resources/js/cmsadmin.js on lines 1107..1117

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 187.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  public function testCountLangaugeAsSubCompare()
                  {
                      $this->assertEquals(1, count((new Query())->where(['nav_id' => 10])->lang('en')->one()->parents));
                      //$this->assertEquals(1, count((new Query())->where(['nav_id' => 10])->lang('de')->one()->parents));
              
              
              Severity: Major
              Found in tests/src/menu/ItemTest.php and 4 other locations - About 5 hrs to fix
              tests/src/menu/ItemTest.php on lines 172..185
              tests/src/menu/ItemTest.php on lines 202..215
              tests/src/menu/ItemTest.php on lines 232..245
              tests/src/menu/ItemTest.php on lines 247..260

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 189.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  public function testCountLangaugeCompare()
                  {
                      $this->assertEquals(0, count((new Query())->where(['nav_id' => 1])->lang('en')->one()->parents));
                      //$this->assertEquals(0, count((new Query())->where(['nav_id' => 1])->lang('de')->one()->parents));
              
              
              Severity: Major
              Found in tests/src/menu/ItemTest.php and 4 other locations - About 5 hrs to fix
              tests/src/menu/ItemTest.php on lines 187..200
              tests/src/menu/ItemTest.php on lines 202..215
              tests/src/menu/ItemTest.php on lines 232..245
              tests/src/menu/ItemTest.php on lines 247..260

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 189.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  public function testCountLangaugeAsPageWithChildrenCompare()
                  {
                      $this->assertEquals(0, count((new Query())->where(['nav_id' => 3])->lang('en')->one()->parents));
                      //$this->assertEquals(0, count((new Query())->where(['nav_id' => 3])->lang('de')->one()->parents));
              
              
              Severity: Major
              Found in tests/src/menu/ItemTest.php and 4 other locations - About 5 hrs to fix
              tests/src/menu/ItemTest.php on lines 172..185
              tests/src/menu/ItemTest.php on lines 187..200
              tests/src/menu/ItemTest.php on lines 232..245
              tests/src/menu/ItemTest.php on lines 247..260

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 189.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  public function testCountLangaugeAsPageWithChildrenCompareAsMenuFindOne()
                  {
                      $this->assertEquals(0, count((new Query())->where(['nav_id' => 3])->lang('en')->one()->parents));
                      //$this->assertEquals(0, count((new Query())->where(['nav_id' => 3])->lang('de')->one()->parents));
              
              
              Severity: Major
              Found in tests/src/menu/ItemTest.php and 4 other locations - About 5 hrs to fix
              tests/src/menu/ItemTest.php on lines 172..185
              tests/src/menu/ItemTest.php on lines 187..200
              tests/src/menu/ItemTest.php on lines 202..215
              tests/src/menu/ItemTest.php on lines 232..245

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 189.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 5 locations. Consider refactoring.
              Open

                  public function testCountLangaugeAsSubCompareAsMenuFindOne()
                  {
                      $this->assertEquals(1, count((new Query())->where(['nav_id' => 10])->lang('en')->one()->parents));
                      //$this->assertEquals(1, count((new Query())->where(['nav_id' => 10])->lang('de')->one()->parents));
              
              
              Severity: Major
              Found in tests/src/menu/ItemTest.php and 4 other locations - About 5 hrs to fix
              tests/src/menu/ItemTest.php on lines 172..185
              tests/src/menu/ItemTest.php on lines 187..200
              tests/src/menu/ItemTest.php on lines 202..215
              tests/src/menu/ItemTest.php on lines 247..260

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 189.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              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
                Severity
                Category
                Status
                Source
                Language