d3yii2/d3files

View on GitHub

Showing 71 of 115 total issues

Function maximize has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      value: function maximize() {
        if (!this.isMaximized) {
          // Store modal data before maximize
          this.modalData = {
            width: this.$photoviewer.width(),
Severity: Minor
Found in assets/js/d3photo-view.js - About 1 hr to fix

    Function dragStart has 30 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          var dragStart = function dragStart(dir, e) {
            e = e || window.event;
            e.preventDefault();
            isDragging = true;
            PUBLIC_VARS['isResizing'] = true;
    Severity: Minor
    Found in assets/js/d3photo-view.js - About 1 hr to fix

      Function D3FilesPreview has 29 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          $.D3FilesPreview = function () {
              this.gridSelector = '#ThGridViewTable tbody';
              this.handlers = {
                  previewButton: $('.d3files-preview-widget-load'),
                  previewDropdown: $('.d3files-preview-dropdown'),
      Severity: Minor
      Found in assets/js/d3files-preview.js - About 1 hr to fix

        Method renderDataCellContent has 27 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public function renderDataCellContent($model, $key, $index): string
            {
                try {
                    if (empty($this->recordsWithFiles[$model->id])) {
                        return '';
        Severity: Minor
        Found in components/D3FilesColumn.php - About 1 hr to fix

          Function on has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            var on = function (event, selector, data, callback, one) {
              var autoRemove, delegator, $this = this;
              if (event && !isString(event)) {
                D.each(event, function (type, fn) {
                  $this.on(type, selector, data, fn, one);
          Severity: Minor
          Found in assets/js/d3photo-view.js - About 1 hr to fix

            Method init has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                public function init(): void
                {
                    if (!$this->viewByExtensions) {
                        $this->viewByExtensions = D3Files::getAllowedFileTypes();
                    }
            Severity: Minor
            Found in widgets/D3FilesWidget.php - About 1 hr to fix

              Method createSharedModel has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  public function createSharedModel($id, $expireDays = null, $leftLoadings = null)
                  {
              
                      if (!$hashSalt = Yii::$app->getModule('d3files')->hashSalt) {
                          return false;
              Severity: Minor
              Found in models/D3filesModel.php - About 1 hr to fix

                Method getViewParams has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    public function getViewParams(): ?array
                    {
                        $params = [
                            'showPrevNext' => $this->showPrevNext,
                            'viewType' => $this->viewType,
                Severity: Minor
                Found in widgets/D3FilesPreviewWidget.php - About 1 hr to fix

                  Function loadImage has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                        value: function loadImage(imgSrc, fn, err) {
                          var _this3 = this;
                  
                          // Reset image
                          this.$image.removeAttr('style').attr('src', '');
                  Severity: Minor
                  Found in assets/js/d3photo-view.js - About 1 hr to fix

                    Function add has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function add(element, events, fn, data, selector, delegator, capture) {
                        var id = zid(element), set = (handlers[id] || (handlers[id] = []));
                        events.split(/\s/).forEach(function (event) {
                          if (event == 'ready') return D(document).ready(fn);
                          var handler = parse(event);
                    Severity: Minor
                    Found in assets/js/d3photo-view.js - About 1 hr to fix

                      Function uploadFile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                      Open

                      function uploadFile(file, widget) {
                          "use strict";
                          let form;
                          let fileInputName;
                          let tbl;
                      Severity: Minor
                      Found in assets/js/d3files.js - About 55 mins 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 add has 7 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                        function add(element, events, fn, data, selector, delegator, capture) {
                      Severity: Major
                      Found in assets/js/d3photo-view.js - About 50 mins to fix

                        Function actionRemoveFiles has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                        Open

                            public function actionRemoveFiles(string $modelName): int
                            {
                                $modelMN = new D3filesModelName();
                                if (!$modelNameId = $modelMN->getByName($modelName, false)) {
                                    $this->out('Illegal model name: ' . $modelName);
                        Severity: Minor
                        Found in controllers/CleanFilesController.php - About 45 mins 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 saveFile has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            public static function saveFile(string $fileName,string  $modelName,int $modelId,string $filePath,string $fileTypes,?int $userId = 0): void
                        Severity: Minor
                        Found in models/D3files.php - About 45 mins to fix

                          Function getViewParams has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                          Open

                              public function getViewParams(): ?array
                              {
                                  $params = [
                                      'showPrevNext' => $this->showPrevNext,
                                      'viewType' => $this->viewType,
                          Severity: Minor
                          Found in widgets/D3FilesPreviewWidget.php - About 45 mins 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

                          Avoid deeply nested control flow statements.
                          Open

                                      if (copyIsArray) {
                                        copyIsArray = false;
                                        clone = src && isArray(src) ? src : [];
                                      } else {
                                        clone = src && isPlainObject(src) ? src : {};
                          Severity: Major
                          Found in assets/js/d3photo-view.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                      } else if (copy !== undefined) {
                                        target[name] = copy;
                                      }
                            Severity: Major
                            Found in assets/js/d3photo-view.js - About 45 mins to fix

                              Method saveContent has 6 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                  public static function saveContent(string $fileName,string  $modelName,int $modelId,string $fileContent,string $fileTypes,?int $userId = 0): void
                              Severity: Minor
                              Found in models/D3files.php - About 45 mins to fix

                                Function animate has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                  var animate = function (properties, duration, ease, callback, delay) {
                                Severity: Minor
                                Found in assets/js/d3photo-view.js - About 35 mins to fix

                                  Function on has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                  Open

                                    var on = function (event, selector, data, callback, one) {
                                  Severity: Minor
                                  Found in assets/js/d3photo-view.js - About 35 mins to fix
                                    Severity
                                    Category
                                    Status
                                    Source
                                    Language