luyadev/luya-module-admin

View on GitHub

Showing 331 of 503 total issues

Method save has 45 lines of code (exceeds 25 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 1 hr to fix

    Method ngRestConfigDefine has 45 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function ngRestConfigDefine(ConfigBuilder $config, $assignedType, array $fields)
        {
            $types = $this->ngRestAttributeTypes();
            $extraTypes = $this->ngRestExtraAttributeTypes();
    
    
    Severity: Minor
    Found in src/ngrest/base/NgRestModel.php - About 1 hr to fix

      Function actionExport has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function actionExport()
          {
              $extension = null;
              $mime = null;
              $header = Yii::$app->request->getBodyParam('header', 1);
      Severity: Minor
      Found in src/ngrest/base/Api.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function getOptionsData has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          private function getOptionsData($event)
          {
              $items = [];
              $targetModel = new $this->model();
              foreach ($this->model->find()->asArray($this->asArray)->all() as $item) {
      Severity: Minor
      Found in src/ngrest/plugins/CheckboxRelation.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function onAfterListFind has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function onAfterListFind($event)
          {
              if (!$this->assignAfterFind) {
                  return parent::onAfterListFind($event);
              }
      Severity: Minor
      Found in src/ngrest/plugins/Select.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function actionReset has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function actionReset()
          {
              if (!$this->module->resetPassword) {
                  throw new ForbiddenHttpException();
              }
      Severity: Minor
      Found in src/controllers/LoginController.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function run has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function run()
          {
              $modules = Yii::$app->getModules();
              $ids = [];
              foreach ($modules as $id => $moduleObject) {
      Severity: Minor
      Found in src/importers/AuthImporter.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function actionIndex has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

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

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function getPathsFromControllerMap has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          protected function getPathsFromControllerMap()
          {
              foreach ($this->controllerMap as $key => $map) {
                  if (is_array($map)) {
                      $controller = Yii::createObject($map['class'], [$key, $map['module']]);
      Severity: Minor
      Found in src/openapi/Generator.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Function getUseClasses has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          public function getUseClasses()
          {
              $file = $this->reflection->getFileName();
              $tokens = \PhpToken::tokenize(file_get_contents($file));
      
      
      Severity: Minor
      Found in src/openapi/phpdoc/PhpDocParser.php - About 1 hr to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

      Method filter has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          private function filter()
          {
              $containerData = $this->getDataProvider();
              $whereExpression = $this->_where;
      
      
      Severity: Minor
      Found in src/storage/QueryTrait.php - About 1 hr to fix

        Method getResponseContent has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            protected function getResponseContent()
            {
                $modelClass = $this->extractModelClassFromObject($this->getActionObject());
        
                if ($modelClass) {
        Severity: Minor
        Found in src/openapi/specs/BaseSpecs.php - About 1 hr to fix

          Function link has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  link: function (scope, element, attrs) {
                      scope.elementWidth = 0;
          
                      var getElementOriginalWidth = function () {
                          var elementClone = element.clone().insertAfter(element);
          Severity: Minor
          Found in src/resources/js/directives.js - About 1 hr to fix

            Method updateItemIndex has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                protected function updateItemIndex(AfterSaveEvent $event, $isNewRecord = false)
                {
                    $attributeName = self::sortableField();
                    $oldPosition = array_key_exists($attributeName, $event->changedAttributes) ? $event->changedAttributes[$attributeName] : false;
                    $newPosition = $event->sender[$attributeName];
            Severity: Minor
            Found in src/traits/SortableTrait.php - About 1 hr to fix

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

                      controller: ['$scope', '$timeout', function ($scope, $timeout) {
                          $scope.pageNumberInputVal = $scope.currentPage;
              
                          $scope.$watch('currentPage', function(newVal) {
                              $scope.pageNumberInputVal = newVal;
              Severity: Minor
              Found in src/resources/js/directives.js - About 1 hr to fix

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

                        controller: ['$scope', '$filter', function ($scope, $filter) {
                
                            if ($scope.model === undefined) {
                                $scope.model = [];
                            }
                Severity: Minor
                Found in src/resources/js/formdirectives.js - About 1 hr to fix

                  Method addFile has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function addFile($fileSource, $fileName, $folderId = 0, $isHidden = false)
                      {
                          // ensure the file upload
                          $fileData = $this->ensureFileUpload($fileSource, $fileName);
                          // generate md5 hash from file source
                  Severity: Minor
                  Found in src/storage/BaseFileSystemStorage.php - About 1 hr to fix

                    Method ensureFileUpload has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function ensureFileUpload($fileSource, $fileName)
                        {
                            // throw exception if source or name is empty
                            if (empty($fileSource) || empty($fileName)) {
                                throw new Exception("Filename and source can not be empty.");
                    Severity: Minor
                    Found in src/storage/BaseFileSystemStorage.php - About 1 hr to fix

                      Method safeUp has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          public function safeUp()
                          {
                              // admin_auth
                              $this->createIndex('index_route', '{{%admin_auth}}', ['route']);
                              $this->createIndex('index_api', '{{%admin_auth}}', ['api']);
                      Severity: Minor
                      Found in src/migrations/m180723_120432_indexes.php - About 1 hr to fix

                        Function addImage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function addImage($fileId, $filterId = 0, $throwException = false)
                            {
                                try {
                                    // if the filterId is provded as a string the filter will be looked up by its name in the get filters array list.
                                    if (is_string($filterId) && !is_numeric($filterId)) {
                        Severity: Minor
                        Found in src/storage/BaseFileSystemStorage.php - About 1 hr to fix

                        Cognitive Complexity

                        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

                        A method's cognitive complexity is based on a few simple rules:

                        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
                        • Code is considered more complex for each "break in the linear flow of the code"
                        • Code is considered more complex when "flow breaking structures are nested"

                        Further reading

                        Severity
                        Category
                        Status
                        Source
                        Language