luyadev/luya-module-admin

View on GitHub

Showing 331 of 503 total issues

Function actionCreate has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    public function actionCreate()
    {
        // 1. ask for module
        if ($this->moduleName === null) {
            Console::clearScreenBeforeCursor();
Severity: Minor
Found in src/commands/CrudController.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 parseDocBlockToArrays has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

    protected function parseDocBlockToArrays(PhpDocReflection $reflection)
    {
        $rows = [
            'texts' => [],
            'return' => [], // @return <type> <description>
Severity: Minor
Found in src/openapi/phpdoc/PhpDocParser.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 actions has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    public function actions()
    {
        $actions = [
            'index' => [ // for casual api request behavior
                'class' => 'luya\admin\ngrest\base\actions\IndexAction',
Severity: Major
Found in src/ngrest/base/Api.php - About 2 hrs to fix

    Method getModuleItems has 52 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getModuleItems($nodeId)
        {
            if (isset($this->_nodeItems[$nodeId])) {
                return $this->_nodeItems[$nodeId];
            }
    Severity: Major
    Found in src/components/AdminMenu.php - About 2 hrs to fix

      Method createImage has 50 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function createImage($fileId, $filterId)
          {
              gc_collect_cycles();
      
              $image = StorageImage::find()->where(['file_id' => $fileId, 'filter_id' => $filterId])->one();
      Severity: Minor
      Found in src/storage/BaseFileSystemStorage.php - About 2 hrs to fix

        Consider simplifying this complex logical expression.
        Open

          "pluralCat": function(n, opt_precision) {  var i = n | 0;  var vf = getVF(n, opt_precision);  if (i == 1 && vf.v == 0) {    return PLURAL_CATEGORY.ONE;  }  if (vf.v == 0 && i % 10 >= 2 && i % 10 <= 4 && (i % 100 < 12 || i % 100 > 14)) {    return PLURAL_CATEGORY.FEW;  }  if (vf.v == 0 && i != 1 && i % 10 >= 0 && i % 10 <= 1 || vf.v == 0 && i % 10 >= 5 && i % 10 <= 9 || vf.v == 0 && i % 100 >= 12 && i % 100 <= 14) {    return PLURAL_CATEGORY.MANY;  }  return PLURAL_CATEGORY.OTHER;}
        Severity: Critical
        Found in src/resources/angular-i18n/angular-locale_pl.js - About 2 hrs to fix

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

              public function actionIndex($query)
              {
                  $search = [];
                  $module = Yii::$app->getModule('admin');
          
          
          Severity: Minor
          Found in src/apis/SearchController.php - About 2 hrs to fix

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

                public function actionIndex($identifier, $token)
                {
                    $machine = ProxyMachine::findOne(['identifier' => $identifier, 'is_deleted' => false]);
            
                    if (!$machine) {
            Severity: Minor
            Found in src/apis/ProxyController.php - About 1 hr to fix

              Function generateMonthAndYearHeader has 48 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  , generateMonthAndYearHeader = function generateMonthAndYearHeader(prevButton, nextButton, preventMobile) {
              
                    if (preventMobile) {
              
                      isMobile = false;
              Severity: Minor
              Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

                Function appendFieldOption has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function appendFieldOption($fieldName, $optionKey, $optionValue)
                    {
                        foreach ($this->getConfig() as $pointer => $fields) {
                            if (is_array($fields)) {
                                foreach ($fields as $field) {
                Severity: Minor
                Found in src/ngrest/Config.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 actionSync has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function actionSync()
                    {
                        $this->db = Instance::ensure($this->db, Connection::class);
                
                        if ($this->url === null) {
                Severity: Minor
                Found in src/commands/ProxyController.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 getProperties has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                Open

                    public function getProperties($phpDocProperties = true)
                    {
                        $properties = [];
                        $attributeFields = [];
                
                
                Severity: Minor
                Found in src/openapi/specs/ActiveRecordToSchema.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 controller has 15 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                            function ($scope, $http, $filter, $timeout, $q, HtmlStorage, cfpLoadingBar, Upload, ServiceFoldersData, ServiceFilesData, LuyaLoading, AdminToastService, ServiceFoldersDirectoryId, ServiceAdminTags, ServiceQueueWaiting) {
                Severity: Major
                Found in src/resources/js/directives.js - About 1 hr to fix

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

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

                    Method generateModelContent has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        public function generateModelContent($fileNamepsace, $className, $apiEndpoint, TableSchema $schema, $i18nFields)
                        {
                            $alias = Inflector::humanize(Inflector::camel2words($className));
                            $dbTableName = $schema->fullName;
                    
                    
                    Severity: Minor
                    Found in src/commands/CrudController.php - About 1 hr to fix

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

                              controller: ['$scope', '$http', '$timeout', function($scope, $http, $timeout) {
                                  // the loaded file to crop
                                  $scope.file;
                                  // cropper image
                                  $scope.cropperImage;
                      Severity: Minor
                      Found in src/resources/js/directives.js - About 1 hr to fix

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

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

                          Function localDateTimestamp has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                    , localDateTimestamp = function localDateTimestamp(rawDate, dateFormatDefinition) {
                                      
                                      var formattingTokens = /(\[[^\[]*\])|(\\)?([Hh]mm(ss)?|MMMM|MMM|MM|M|dd?d?|yy?yy?y?|gg(ggg?)?|GG(GGG?)?|e|E|a|A|hh?|HH?|kk?|mm?|ss?|S{1,9}|x|X|zz?|ZZ?|.)/g
                                      ,formatDate,dateSplit, m, d, y, index, el, longName, shortName;
                          
                          
                          Severity: Minor
                          Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

                            Function setDaysInMonth has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                      , setDaysInMonth = function setDaysInMonth(month, year) {
                            
                                        var i
                                          , limitDate = new Date(year, month, 0).getDate()
                                          , firstDayMonthNumber = new Date(year + '/' + month + '/' + 1).getDay()
                            Severity: Minor
                            Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

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

                                  public function actionServices()
                                  {
                                      $settings = [];
                                      $apiEndpoint = $this->model->ngRestApiEndpoint();
                                      $userSortSettings = Yii::$app->adminuser->identity->setting->get('ngrestorder.admin/'.$apiEndpoint, false);
                              Severity: Minor
                              Found in src/ngrest/base/Api.php - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language