d3yii2/d3files

View on GitHub

Showing 115 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

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

      <?php
      /**
       * Message translations.
       *
       * This file is automatically generated by 'yii message/extract' command.
      Severity: Major
      Found in messages/lv-LV/d3files.php and 1 other location - About 1 day to fix
      messages/lv/d3files.php on lines 1..74

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

      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

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

      <?php
      /**
       * Message translations.
       *
       * This file is automatically generated by 'yii message/extract' command.
      Severity: Major
      Found in messages/lv/d3files.php and 1 other location - About 1 day to fix
      messages/lv-LV/d3files.php on lines 1..74

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

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

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

                      se: {
                        top: heightDiff >= δ ? (heightDiff + δ) / 2 + 'px' : imgTop > heightDiff ? imgTop + 'px' : heightDiff + 'px',
                        left: widthDiff >= -δ ? (widthDiff - δ) / 2 + 'px' : imgLeft > widthDiff ? imgLeft + 'px' : widthDiff + 'px'
                      },
            Severity: Major
            Found in assets/js/d3photo-view.js and 3 other locations - About 3 hrs to fix
            assets/js/d3photo-view.js on lines 1749..1752
            assets/js/d3photo-view.js on lines 1753..1756
            assets/js/d3photo-view.js on lines 1757..1760

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

            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 4 locations. Consider refactoring.
            Open

                      sw: {
                        top: heightDiff >= δ ? (heightDiff + δ) / 2 + 'px' : imgTop > heightDiff ? imgTop + 'px' : heightDiff + 'px',
                        left: widthDiff2 >= -δ ? (widthDiff2 - δ) / 2 + 'px' : imgLeft2 > widthDiff2 ? imgLeft2 + 'px' : widthDiff2 + 'px'
                      }
            Severity: Major
            Found in assets/js/d3photo-view.js and 3 other locations - About 3 hrs to fix
            assets/js/d3photo-view.js on lines 1739..1742
            assets/js/d3photo-view.js on lines 1749..1752
            assets/js/d3photo-view.js on lines 1753..1756

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

            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 4 locations. Consider refactoring.
            Open

                      nw: {
                        top: heightDiff2 >= δ ? (heightDiff2 + δ) / 2 + 'px' : imgTop2 > heightDiff2 ? imgTop2 + 'px' : heightDiff2 + 'px',
                        left: widthDiff2 >= -δ ? (widthDiff2 - δ) / 2 + 'px' : imgLeft2 > widthDiff2 ? imgLeft2 + 'px' : widthDiff2 + 'px'
                      },
            Severity: Major
            Found in assets/js/d3photo-view.js and 3 other locations - About 3 hrs to fix
            assets/js/d3photo-view.js on lines 1739..1742
            assets/js/d3photo-view.js on lines 1753..1756
            assets/js/d3photo-view.js on lines 1757..1760

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

            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 4 locations. Consider refactoring.
            Open

                      ne: {
                        top: heightDiff2 >= δ ? (heightDiff2 + δ) / 2 + 'px' : imgTop2 > heightDiff2 ? imgTop2 + 'px' : heightDiff2 + 'px',
                        left: widthDiff >= -δ ? (widthDiff - δ) / 2 + 'px' : imgLeft > widthDiff ? imgLeft + 'px' : widthDiff + 'px'
                      },
            Severity: Major
            Found in assets/js/d3photo-view.js and 3 other locations - About 3 hrs to fix
            assets/js/d3photo-view.js on lines 1739..1742
            assets/js/d3photo-view.js on lines 1749..1752
            assets/js/d3photo-view.js on lines 1757..1760

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

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