d3yii2/d3files

View on GitHub

Showing 71 of 115 total issues

File d3photo-view.js has 2087 lines of code (exceeds 250 allowed). Consider refactoring.
Open

(function (global, factory) {
  typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
  typeof define === 'function' && define.amd ? define(factory) :
  (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.photoviewer = factory());
}(this, (function () { 'use strict';
Severity: Major
Found in assets/js/d3photo-view.js - About 5 days to fix

    Function PhotoViewer has 606 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      var PhotoViewer = /*#__PURE__*/function () {
        function PhotoViewer(items, options, el) {
          _classCallCheck(this, PhotoViewer);
    
          this.options = $.extend(true, {}, DEFAULTS, options);
    Severity: Major
    Found in assets/js/d3photo-view.js - About 3 days to fix

      Function resizable has 200 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          resizable: function resizable(modal, stage, image, minWidth, minHeight) {
            var _this = this;
      
            var resizableHandleE = $("<div class=\"".concat(NS, "-resizable-handle ").concat(NS, "-resizable-handle-e\"></div>"));
            var resizableHandleW = $("<div class=\"".concat(NS, "-resizable-handle ").concat(NS, "-resizable-handle-w\"></div>"));
      Severity: Major
      Found in assets/js/d3photo-view.js - About 1 day to fix

        File d3files-preview.js has 434 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /*jslint browser */
        /*globals D3PDF, console, jQuery, D3FilesPreviewJsVars*/
        /*global D3PDF, console, jQuery, D3FilesPreviewJsVars*/
        /*jshint esversion: 6 */
        /**
        Severity: Minor
        Found in assets/js/d3files-preview.js - About 6 hrs to fix

          Method run has 157 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              public function run(int $id): array
              {
                  try {
                      $postModelName = Yii::$app->request->post('model_name');
                      
          Severity: Major
          Found in components/UploadAction.php - About 6 hrs to fix

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

                public function run(int $id): array
                {
                    try {
                        $postModelName = Yii::$app->request->post('model_name');
                        
            Severity: Minor
            Found in components/UploadAction.php - About 3 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 init has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
            Open

                public function init(): void
                {
                    parent::init();
            
                    // Backward compatibility
            Severity: Minor
            Found in widgets/D3FilesPreviewWidget.php - About 3 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 actionUnusedFiles has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
            Open

                public function actionUnusedFiles(string $modelName): int
                {
            
                    $modelMN = new D3filesModelName();
                    if (!$modelNameId = $modelMN->getByName($modelName, false)) {
            Severity: Minor
            Found in controllers/CleanFilesController.php - About 3 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 init has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                public function init(): void
                {
                    if (!$this->options) {
                        $this->options = ['multiple' => true];
                    }
            Severity: Minor
            Found in widgets/D3FilesUploadWidget.php - About 3 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 run has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
            Open

                public function run(int $id, string $model_name_id = ''): void
                {
            
                    if (!$model_name_id){
                        if (empty($this->modelName)) {
            Severity: Minor
            Found in components/DownloadAction.php - About 3 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 movable has 75 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                movable: function movable(stage, image) {
                  var _this = this;
            
                  var isDragging = false;
                  var startX = 0;
            Severity: Major
            Found in assets/js/d3photo-view.js - About 3 hrs to fix

              File D3files.php has 284 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              <?php
              
              namespace d3yii2\d3files\models;
              
              use d3system\exceptions\D3ActiveRecordException;
              Severity: Minor
              Found in models/D3files.php - About 2 hrs to fix

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

                    public function init(): void
                    {
                        parent::init();
                
                        // Backward compatibility
                Severity: Major
                Found in widgets/D3FilesPreviewWidget.php - About 2 hrs to fix

                  Method run has 68 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      public function run(int $id, string $model_name_id = ''): void
                      {
                  
                          if (!$model_name_id){
                              if (empty($this->modelName)) {
                  Severity: Major
                  Found in components/DownloadAction.php - About 2 hrs to fix

                    Function _keydown has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                          value: function _keydown(e) {
                            if (!this.options.keyboard) {
                              return false;
                            }
                    
                    
                    Severity: Major
                    Found in assets/js/d3photo-view.js - About 2 hrs to fix

                      Function uploadFile has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      function uploadFile(file, widget) {
                          "use strict";
                          let form;
                          let fileInputName;
                          let tbl;
                      Severity: Major
                      Found in assets/js/d3files.js - About 2 hrs to fix

                        Function zoomTo has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                              value: function zoomTo(ratio, origin, e) {
                                var $image = this.$image;
                                var $stage = this.$stage;
                                var imgData = {
                                  w: this.imageData.width,
                        Severity: Major
                        Found in assets/js/d3photo-view.js - About 2 hrs to fix

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

                              public static function fileListForWidget(
                                  string $modelName,
                                  int $modelId,
                                  bool $forPath = false
                              ): array
                          Severity: Major
                          Found in models/D3files.php - About 2 hrs to fix

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

                                public function init(): void
                                {
                                    if (!$this->options) {
                                        $this->options = ['multiple' => true];
                                    }
                            Severity: Major
                            Found in widgets/D3FilesUploadWidget.php - About 2 hrs to fix

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

                                var anim = function (properties, duration, ease, callback, delay) {
                                  var key, cssValues = {}, cssProperties, transforms = '',
                                    that = this, wrappedCallback, endEvent = D.fx.transitionEnd,
                                    fired = false;
                              
                              
                              Severity: Minor
                              Found in assets/js/d3photo-view.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language