luyadev/luya-module-admin

View on GitHub

Showing 503 of 503 total issues

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

        controller: ['$scope', '$timeout', function ($scope, $timeout) {
            if ($scope.autocomplete === undefined || $scope.autocomplete === '') {
                $scope.autocomplete = 'on';
            }

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 1441..1449

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

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

            $timeout(function () {
                if ($scope.optionsvalue === undefined || $scope.optionsvalue === "") {
                    $scope.optionsvalue = 'value';
                }

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 1385..1393

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

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

        controller: ['$scope', '$filter', function ($scope, $filter) {

            $scope.$watch(function () {
                return $scope.model
            }, function (n, o) {
Severity: Major
Found in src/resources/js/formdirectives.js - About 2 hrs to fix

    Method getButtons has 55 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public function getButtons()
        {
            // if already assigned return the resutl
            if ($this->_buttons) {
                return $this->_buttons;
    Severity: Major
    Found in src/ngrest/render/RenderCrud.php - About 2 hrs to fix

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

                  for (i; i <= dateDisabledDates.length; i += 1) {
      
                    if (new Date(dateDisabledDates[i]).getTime() === new Date(monthNumber + '/' + day + '/' + year).getTime()) {
      
                      return false;
      src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js on lines 816..822

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

      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

                  for (i; i <= dateEnabledDates.length; i += 1) {
      
                    if (new Date(dateEnabledDates[i]).getTime() === new Date(monthNumber + '/' + day + '/' + year).getTime()) {
      
                      return true;
      src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js on lines 805..811

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

      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

      Method getModules has 54 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          public function getModules()
          {
              if ($this->_modules !== null) {
                  return $this->_modules;
              }
      Severity: Major
      Found in src/components/AdminMenu.php - About 2 hrs to fix

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

            public function getButtons()
            {
                // if already assigned return the resutl
                if ($this->_buttons) {
                    return $this->_buttons;
        Severity: Minor
        Found in src/ngrest/render/RenderCrud.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 callbackUpload has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
        Open

            public function callbackUpload()
            {
                $config = new Config();
                $config->setTempDir($this->getTempFolder());
                $file = new File($config);
        Severity: Minor
        Found in src/aws/FlowActiveWindow.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 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

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

                          $scope.clearModule = 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 2 hrs to fix
                  src/resources/js/controllers.js on lines 981..985

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

                  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.toggleModule = 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 2 hrs to fix
                  src/resources/js/controllers.js on lines 975..979

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

                  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

                  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
                      Severity
                      Category
                      Status
                      Source
                      Language