luyadev/luya-module-admin

View on GitHub

Showing 503 of 503 total issues

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

    public function actionIndex()
    {
        try {
            Image::getImagine();
        } catch (\Exception $e) {
Severity: Major
Found in src/commands/SetupController.php - About 3 hrs to fix

    Method generateRules has 85 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function generateRules($table)
        {
            $types = [];
            $lengths = [];
            foreach ($table->columns as $column) {
    Severity: Major
    Found in src/base/BaseCrudController.php - About 3 hrs to fix

      File CrudController.php has 307 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      <?php
      
      namespace luya\admin\commands;
      
      use luya\admin\base\BaseCrudController;
      Severity: Minor
      Found in src/commands/CrudController.php - About 3 hrs to fix

        Function save has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            public function save()
            {
                // get the filter model based on the current filter.
                $filterModel = $this->findModel();
                // update the name of the filter if changed
        Severity: Minor
        Found in src/base/Filter.php - About 3 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 link has 81 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                link: function (scope, element, attr) {
                    var inlineModal = element.find('.inlinemodal');
                    var inlineModalArrow = element.find('.inlinemodal-arrow');
                    var button = element.find('.scheduler-btn');
        
        
        Severity: Major
        Found in src/resources/js/scheduler.js - About 3 hrs to fix

          Api has 27 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class Api extends RestActiveController
          {
              /**
               * @var string Defines the related model for the NgRest Controller. The full qualiefied model name
               * is required.
          Severity: Minor
          Found in src/ngrest/base/Api.php - About 3 hrs to fix

            Function template has 78 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    template: function () {
                        return '<div class="scheduler" ng-class="{\'inlinemodal--open\' : isVisible}">'+
                                    '<button ng-click="toggleWindow()" type="button" class="scheduler-btn btn btn-link">' +
                                        '<i class="material-icons">schedule</i><span ng-hide="onlyIcon">{{valueToLabel(value)}}</span>' +
                                    '</button>' +
            Severity: Major
            Found in src/resources/js/scheduler.js - About 3 hrs to fix

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

                          return '' +
                              '<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}">' +
                              '<div class="form-side form-side-label">' +
                              '<label>{{label}}</label>' +
                              '</div>' +
              Severity: Major
              Found in src/resources/js/formdirectives.js and 1 other location - About 3 hrs to fix
              src/resources/js/formdirectives.js on lines 2913..2934

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

              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 '' +
                              '<div class="form-group form-side-by-side" ng-class="{\'input--hide-label\': i18n}">' +
                                  '<div class="form-side form-side-label">' +
                                      '<label>{{label}}</label>' +
                                  '</div>' +
              Severity: Major
              Found in src/resources/js/formdirectives.js and 1 other location - About 3 hrs to fix
              src/resources/js/formdirectives.js on lines 3084..3105

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

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

                  public function getExtraFields()
                  {
                      if ($this->_extraFields === null) {
                          $extraFields = [];
                          foreach ($this->getConfig() as $pointer => $fields) {
              Severity: Minor
              Found in src/ngrest/Config.php - About 3 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 actionTwofaToken has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
              Open

                  public function actionTwofaToken()
                  {
                      if (($lockout = $this->sessionBruteForceLock(Yii::$app->session->get('secureId')))) {
                          return $this->sendArray(false, [Module::t('login_async_submission_limit_reached', ['time' =>  Yii::$app->formatter->asRelativeTime($lockout)])]);
                      }
              Severity: Minor
              Found in src/controllers/LoginController.php - About 3 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 2 locations. Consider refactoring.
              Open

                      $scope.toggleAll = function() {
                          angular.forEach($scope.auths,function(items) {
                              angular.forEach(items, function(value) {
                                  $scope.rights[value.id] = {base: 1, create: 1, update: 1, 'delete': 1 };
                              });
              Severity: Major
              Found in src/resources/js/controllers.js and 1 other location - About 3 hrs to fix
              src/resources/js/controllers.js on lines 1010..1016

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

              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.untoggleAll = function() {
                          angular.forEach($scope.auths,function(items) {
                              angular.forEach(items, function(value) {
                                  $scope.rights[value.id] = {base: 0, create: 0, update: 0, 'delete': 0 };
                              });
              Severity: Major
              Found in src/resources/js/controllers.js and 1 other location - About 3 hrs to fix
              src/resources/js/controllers.js on lines 1002..1008

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

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

                      controller: ['$scope', '$filter', function ($scope, $filter) {
              
                          $scope.isNumeric = function (num) {
                              return !isNaN(num)
                          }
              Severity: Major
              Found in src/resources/js/formdirectives.js - About 3 hrs to fix

                Function getPlugins has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getPlugins()
                    {
                        if ($this->_plugins === null) {
                            $plugins = [];
                            foreach ($this->getConfig() as $pointer => $fields) {
                Severity: Minor
                Found in src/ngrest/Config.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 filter has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    private function filter()
                    {
                        $containerData = $this->getDataProvider();
                        $whereExpression = $this->_where;
                
                
                Severity: Minor
                Found in src/storage/QueryTrait.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 2 locations. Consider refactoring.
                Open

                            $scope.add = function () {
                                if ($scope.model === null || $scope.model === '' || $scope.model === undefined) {
                                    $scope.model = [];
                                }
                                $scope.model.push({ imageId: 0, caption: '' });
                Severity: Major
                Found in src/resources/js/formdirectives.js and 1 other location - About 2 hrs to fix
                src/resources/js/formdirectives.js on lines 2769..2774

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

                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.add = function () {
                                if ($scope.model === null || $scope.model === '' || $scope.model === undefined) {
                                    $scope.model = [];
                                }
                                $scope.model.push({ fileId: 0, caption: '' });
                Severity: Major
                Found in src/resources/js/formdirectives.js and 1 other location - About 2 hrs to fix
                src/resources/js/formdirectives.js on lines 2667..2672

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

                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 crud.php has 287 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                <?php
                use luya\admin\helpers\Angular;
                use luya\admin\Module;
                use luya\admin\ngrest\render\RenderCrud;
                use luya\helpers\ArrayHelper;
                Severity: Minor
                Found in src/views/ngrest/crud.php - About 2 hrs to fix

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

                  <?php
                  
                  namespace luya\admin\file;
                  
                  use luya\admin\storage\QueryTrait;
                  Severity: Major
                  Found in src/file/Query.php and 2 other locations - About 2 hrs to fix
                  src/folder/Query.php on lines 1..58
                  src/image/Query.php on lines 1..81

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

                  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