luyadev/luya-module-admin

View on GitHub

Showing 503 of 503 total issues

Consider simplifying this complex logical expression.
Open

      if (navigator.userAgent &&
        (navigator.userAgent.match(/Android/i) ||
        navigator.userAgent.match(/webOS/i) ||
        navigator.userAgent.match(/iPhone/i) ||
        navigator.userAgent.match(/iPad/i) ||
Severity: Critical
Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

    Method prepareDataProvider has 33 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        protected function prepareDataProvider()
        {
            $requestParams = Yii::$app->getRequest()->getBodyParams();
            if (empty($requestParams)) {
                $requestParams = Yii::$app->getRequest()->getQueryParams();
    Severity: Minor
    Found in src/ngrest/base/actions/IndexAction.php - About 1 hr to fix

      Function showCalendar has 33 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                , showCalendar = function showCalendar() {
                  //lets hide all the latest instances of datepicker
                  pageDatepickers = $window.document.getElementsByClassName('_720kb-datepicker-calendar');
      
                  angular.forEach(pageDatepickers, function forEachDatepickerPages(value, key) {
      Severity: Minor
      Found in src/resources/vendorlibs/angularjs-datepicker/angular-datepicker.js - About 1 hr to fix

        Function update has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                var update = function () {
                    if ($shadow == null) {
                        $shadow = angular.element('<div></div>').css({
                            position: 'absolute',
                            top: -10000,
        Severity: Minor
        Found in src/resources/js/directives.js - About 1 hr to fix

          Method getAvailableApiEndpoints has 33 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              protected function getAvailableApiEndpoints()
              {
                  $data = [];
                  $generic = [];
                  $userId = $this->model->id;
          Severity: Minor
          Found in src/aws/ApiOverviewActiveWindow.php - About 1 hr to fix

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

                        element.on('dragenter', function(e) {
                            e = e.originalEvent || e;
                            scope.addClass(scope.dndCss.onHover);
                            e.preventDefault();
                        });
            Severity: Major
            Found in src/resources/js/dnd.js and 1 other location - About 1 hr to fix
            src/resources/js/dnd.js on lines 151..155

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

            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

                        element.on('dragend', function(e) {
                            e = e.originalEvent || e;
                            scope.removeClass(scope.dndCss.onDrag);
                            e.stopPropagation();
                        });
            Severity: Major
            Found in src/resources/js/dnd.js and 1 other location - About 1 hr to fix
            src/resources/js/dnd.js on lines 222..226

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

            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 addImage has 32 lines of code (exceeds 25 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

              Function searchDetailClick has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      $scope.searchDetailClick = function(itemConfig, itemData) {
                          if (itemConfig.type === 'custom') {
                              $scope.click(itemConfig.menuItem, true).then(function() {
                                  if (itemConfig.stateProvider) {
                                      var params = {};
              Severity: Minor
              Found in src/resources/js/controllers.js - About 1 hr to fix

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

                        template: function () {
                            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>' +
                Severity: Minor
                Found in src/resources/js/formdirectives.js - About 1 hr to fix

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

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

                      Function addFile has a Cognitive Complexity of 11 (exceeds 5 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

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

                          private function formatExportValues(ActiveQuery $query, array $formatter)
                          {
                              Yii::$app->formatter->nullDisplay = '';
                              $data = [];
                              $rowId = 0;
                      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 ngRestConfig has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function ngRestConfig($config)
                          {
                              foreach ($this->ngRestScopes() as $arrayConfig) {
                                  if (!isset($arrayConfig[0]) && !isset($arrayConfig[1])) {
                                      throw new InvalidConfigException("Invalid ngRestScope definition. Definition must contain an array with two elements: `['create', []]`");
                      Severity: Minor
                      Found in src/ngrest/base/NgRestModel.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 extractFilesDataFromMultipleFiles has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function extractFilesDataFromMultipleFiles(array $files)
                          {
                              $data = [];
                              $i = 0;
                              foreach ($files as $type => $field) {
                      Severity: Minor
                      Found in src/helpers/Storage.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 getActiveLanguage has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function getActiveLanguage()
                          {
                              if ($this->_activeLanguage === null) {
                                  if ($this->activeShortCodeCallable && is_callable($this->activeShortCodeCallable)) {
                                      $langShortCode = call_user_func($this->activeShortCodeCallable, $this);
                      Severity: Minor
                      Found in src/components/AdminLanguage.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 extractFilesDataFromFilesArray has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public static function extractFilesDataFromFilesArray(array $file)
                          {
                              if (!isset($file['tmp_name'])) {
                                  return [];
                              }
                      Severity: Minor
                      Found in src/helpers/Storage.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 actionFixTableNames has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function actionFixTableNames()
                          {
                              $batch = TagRelation::find()->batch();
                              $i = 0;
                              $fixed = 0;
                      Severity: Minor
                      Found in src/commands/TagController.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 validatePassword has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                      Open

                          public function validatePassword($attribute)
                          {
                              if (!$this->hasErrors()) {
                                  $user = $this->getUser();
                      
                      
                      Severity: Minor
                      Found in src/models/LoginForm.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