luyadev/luya-module-admin

View on GitHub

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

              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

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

                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

                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

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

                          controller: ['$scope', '$timeout', '$rootScope', function ($scope, $timeout, $rootScope) {
                  
                              $scope.isOpen = 0;
                              $scope.isDefault = 1;
                  
                  
                  Severity: Major
                  Found in src/resources/js/formdirectives.js - About 2 hrs to fix

                    Function paginateYears has 71 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            $scope.paginateYears = function paginateYears(startingYear) {
                              var i
                               , theNewYears = []
                               , daysToPrepend = 10
                               , daysToAppend = 10;
                    Severity: Major
                    Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 2 hrs to fix

                      CrudController has 25 functions (exceeds 20 allowed). Consider refactoring.
                      Open

                      class CrudController extends BaseCrudController
                      {
                          /**
                           * @var boolean Whether the core modules should be hidden from selection list or not.
                           */
                      Severity: Minor
                      Found in src/commands/CrudController.php - About 2 hrs to fix

                        Function actionAsync has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function actionAsync()
                            {
                                if (($lockout = $this->sessionBruteForceLock(0))) {
                                    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 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

                        Method actionCreate has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            public function actionCreate()
                            {
                                // 1. ask for module
                                if ($this->moduleName === null) {
                                    Console::clearScreenBeforeCursor();
                        Severity: Major
                        Found in src/commands/CrudController.php - About 2 hrs to fix

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

                                  controller: ['$scope', function ($scope) {
                          
                                      if ($scope.model === undefined) {
                                          $scope.model = [{ 0: '' }];
                                      }
                          Severity: Major
                          Found in src/resources/js/formdirectives.js - About 2 hrs to fix

                            StorageController has 24 functions (exceeds 20 allowed). Consider refactoring.
                            Open

                            class StorageController extends RestController
                            {
                                use CacheableTrait;
                            
                                /**
                            Severity: Minor
                            Found in src/apis/StorageController.php - About 2 hrs to fix
                              Severity
                              Category
                              Status
                              Source
                              Language