luyadev/luya-module-cms

View on GitHub

Showing 326 of 326 total issues

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

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

        public function testCfgAppendingOfVars()
        {
            $block = new TestBlock();
            $block->addCfg(['var' => 'append', 'label' => 'test', 'type' => 'zaa-text'], true);
            $block->addCfg(['var' => 'append2', 'label' => 'test2', 'type' => 'zaa-text'], true);
    Severity: Major
    Found in tests/src/base/InternalBaseBlockTest.php and 3 other locations - About 2 hrs to fix
    tests/src/base/InternalBaseBlockTest.php on lines 18..26
    tests/src/base/InternalBaseBlockTest.php on lines 28..36
    tests/src/base/InternalBaseBlockTest.php on lines 48..56

    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 127.

    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 4 locations. Consider refactoring.
    Open

        public function testCfgNotAppendingOfVars()
        {
            $block = new TestBlock();
            $block->addCfg(['var' => 'append', 'label' => 'test', 'type' => 'zaa-text'], false);
            $block->addCfg(['var' => 'append2', 'label' => 'test2', 'type' => 'zaa-text'], false);
    Severity: Major
    Found in tests/src/base/InternalBaseBlockTest.php and 3 other locations - About 2 hrs to fix
    tests/src/base/InternalBaseBlockTest.php on lines 18..26
    tests/src/base/InternalBaseBlockTest.php on lines 28..36
    tests/src/base/InternalBaseBlockTest.php on lines 38..46

    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 127.

    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 4 locations. Consider refactoring.
    Open

        public function testVarNotAppendingOfVars()
        {
            $block = new TestBlock();
            $block->addVar(['var' => 'append', 'label' => 'test', 'type' => 'zaa-text'], false);
            $block->addVar(['var' => 'append2', 'label' => 'test2', 'type' => 'zaa-text'], false);
    Severity: Major
    Found in tests/src/base/InternalBaseBlockTest.php and 3 other locations - About 2 hrs to fix
    tests/src/base/InternalBaseBlockTest.php on lines 18..26
    tests/src/base/InternalBaseBlockTest.php on lines 38..46
    tests/src/base/InternalBaseBlockTest.php on lines 48..56

    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 127.

    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 4 locations. Consider refactoring.
    Open

        public function testVarAppendingOfVars()
        {
            $block = new TestBlock();
            $block->addVar(['var' => 'append', 'label' => 'test', 'type' => 'zaa-text'], true);
            $block->addVar(['var' => 'append2', 'label' => 'test2', 'type' => 'zaa-text'], true);
    Severity: Major
    Found in tests/src/base/InternalBaseBlockTest.php and 3 other locations - About 2 hrs to fix
    tests/src/base/InternalBaseBlockTest.php on lines 28..36
    tests/src/base/InternalBaseBlockTest.php on lines 38..46
    tests/src/base/InternalBaseBlockTest.php on lines 48..56

    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 127.

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

    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

      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

        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

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

                            $scope.arrayToSelect = function(input, valueField, labelField) {
                                var output = [];
                                angular.forEach(input, function(value) {
                                    output.push({"label": value[labelField], "value": value[valueField]});
                                });
            Severity: Major
            Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 2 hrs to fix
            src/admin/resources/js/cmsadmin.js on lines 338..344

            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 78.

            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

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

                            $scope.arrayToSelect = function(input, valueField, labelField) {
                                var output = [];
                                angular.forEach(input, function(value) {
                                    output.push({"label": value[labelField], "value": value[valueField]});
                                });
            Severity: Major
            Found in src/admin/resources/js/cmsadmin.js and 1 other location - About 2 hrs to fix
            src/admin/resources/js/cmsadmin.js on lines 276..282

            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 78.

            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 controller has 53 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                        controller : ['$scope', function($scope) {
            
                            $scope.changeModel = function(data) {
                                $scope.navId = data.id;
                            }
            Severity: Major
            Found in src/admin/resources/js/cmsadmin.js - About 2 hrs to fix

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

                  private function getVariableTypes()
                  {
                      return [
                          'text' => 'Textinput',
                          'textarea' => 'Textarea multi rows input',
              Severity: Major
              Found in src/frontend/commands/BlockController.php and 1 other location - About 2 hrs to fix
              src/frontend/commands/BlockController.php on lines 153..180

              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 123.

              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

                  private function getVariableTypeInterfaceMap()
                  {
                      return [
                          'text' => 'self::TYPE_TEXT',
                          'textarea' => 'self::TYPE_TEXTAREA',
              Severity: Major
              Found in src/frontend/commands/BlockController.php and 1 other location - About 2 hrs to fix
              src/frontend/commands/BlockController.php on lines 124..151

              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 123.

              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

                  public function testAppAliasViewPath()
                  {
                      $pageFixture = $this->createCmsNavItemPageFixture([
                          1 => [
                              'id' => 1,
              Severity: Major
              Found in tests/src/models/NavItemPageTest.php and 1 other location - About 2 hrs to fix
              tests/src/models/NavItemPageTest.php on lines 58..83

              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 123.

              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

                  public function testAbsolutePath()
                  {
                      $pageFixture = $this->createCmsNavItemPageFixture([
                          1 => [
                              'id' => 1,
              Severity: Major
              Found in tests/src/models/NavItemPageTest.php and 1 other location - About 2 hrs to fix
              tests/src/models/NavItemPageTest.php on lines 15..41

              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 123.

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

                  public function actionCleanup()
                  {
                      // return all pages with deleted items
                      $navIds = Nav::find()->where(['is_deleted' => true])->select(['id'])->column();
              
              
              Severity: Minor
              Found in src/frontend/commands/PageController.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 getRowDescriber has a Cognitive Complexity of 16 (exceeds 5 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 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

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

                          106 =>
                          [
                                  'id' => '106',
                                  'nav_id' => '46',
                                  'lang' => 'fr',
              Severity: Major
              Found in tests/src/menu/_dataFrArray.php and 21 other locations - About 2 hrs to fix
              tests/src/menu/_dataFrArray.php on lines 54..78
              tests/src/menu/_dataFrArray.php on lines 79..103
              tests/src/menu/_dataFrArray.php on lines 153..177
              tests/src/menu/_dataFrArray.php on lines 203..227
              tests/src/menu/_dataFrArray.php on lines 228..252
              tests/src/menu/_dataFrArray.php on lines 278..302
              tests/src/menu/_dataFrArray.php on lines 303..327
              tests/src/menu/_dataFrArray.php on lines 328..352
              tests/src/menu/_dataFrArray.php on lines 353..377
              tests/src/menu/_dataFrArray.php on lines 378..402
              tests/src/menu/_dataFrArray.php on lines 403..427
              tests/src/menu/_dataFrArray.php on lines 428..452
              tests/src/menu/_dataFrArray.php on lines 453..477
              tests/src/menu/_dataFrArray.php on lines 503..527
              tests/src/menu/_dataFrArray.php on lines 528..552
              tests/src/menu/_dataFrArray.php on lines 553..577
              tests/src/menu/_dataFrArray.php on lines 578..602
              tests/src/menu/_dataFrArray.php on lines 603..627
              tests/src/menu/_dataFrArray.php on lines 628..652
              tests/src/menu/_dataFrArray.php on lines 653..677
              tests/src/menu/_dataFrArray.php on lines 678..702

              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 122.

              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

              Severity
              Category
              Status
              Source
              Language