d3yii2/d3files

View on GitHub

Showing 115 of 115 total issues

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

        try {
            if (!$model_name) {
                $model_name = $this->modelName;
            }

Severity: Major
Found in components/DeleteAction.php and 1 other location - About 2 hrs to fix
components/EditNotesAction.php on lines 28..52

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

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

        try {
            if (!$fileModel = D3files::findOne($id)) {
                throw new D3FilesUserException(Yii::t('d3files', 'The requested file does not exist.'));
            }
            
Severity: Major
Found in components/EditNotesAction.php and 1 other location - About 2 hrs to fix
components/DeleteAction.php on lines 29..73

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

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

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

                imageData = {
                  w: $(image).width(),
                  h: $(image).height(),
                  l: $(image).position().left,
                  t: $(image).position().top
        Severity: Major
        Found in assets/js/d3photo-view.js and 2 other locations - About 2 hrs to fix
        assets/js/d3photo-view.js on lines 1773..1778
        assets/js/d3photo-view.js on lines 1779..1784

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

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

                  modalData = {
                    w: $(modal).width(),
                    h: $(modal).height(),
                    l: $(modal).offset().left,
                    t: $(modal).offset().top
          Severity: Major
          Found in assets/js/d3photo-view.js and 2 other locations - About 2 hrs to fix
          assets/js/d3photo-view.js on lines 1779..1784
          assets/js/d3photo-view.js on lines 1785..1790

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

                  stageData = {
                    w: $(stage).width(),
                    h: $(stage).height(),
                    l: $(stage).offset().left,
                    t: $(stage).offset().top
          Severity: Major
          Found in assets/js/d3photo-view.js and 2 other locations - About 2 hrs to fix
          assets/js/d3photo-view.js on lines 1773..1778
          assets/js/d3photo-view.js on lines 1785..1790

          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

                    case 173:
                      this.zoom(-this.options.ratioThreshold * 3, {
                        x: this.$stage.width() / 2,
                        y: this.$stage.height() / 2
                      }, e);
          Severity: Major
          Found in assets/js/d3photo-view.js and 1 other location - About 2 hrs to fix
          assets/js/d3photo-view.js on lines 2482..2487

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

          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

                    case 189:
                      this.zoom(-this.options.ratioThreshold * 3, {
                        x: this.$stage.width() / 2,
                        y: this.$stage.height() / 2
                      }, e);
          Severity: Major
          Found in assets/js/d3photo-view.js and 1 other location - About 2 hrs to fix
          assets/js/d3photo-view.js on lines 2498..2503

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

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

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

                    var imgTop = (heightDiff > 0 ? $(image).position().top : $(image).position().top < 0 ? $(image).position().top : 0) + δ;
            Severity: Major
            Found in assets/js/d3photo-view.js and 2 other locations - About 2 hrs to fix
            assets/js/d3photo-view.js on lines 1730..1730
            assets/js/d3photo-view.js on lines 1731..1731

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

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

                    var imgLeft2 = (widthDiff2 > 0 ? $(image).position().left : $(image).position().left < 0 ? $(image).position().left : 0) - δ;
            Severity: Major
            Found in assets/js/d3photo-view.js and 2 other locations - About 2 hrs to fix
            assets/js/d3photo-view.js on lines 1729..1729
            assets/js/d3photo-view.js on lines 1731..1731

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

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

                    var imgTop2 = (heightDiff2 > 0 ? $(image).position().top : $(image).position().top < 0 ? $(image).position().top : 0) + δ;
            Severity: Major
            Found in assets/js/d3photo-view.js and 2 other locations - About 2 hrs to fix
            assets/js/d3photo-view.js on lines 1729..1729
            assets/js/d3photo-view.js on lines 1730..1730

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

            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

                      case 187:
                        this.zoom(this.options.ratioThreshold * 3, {
                          x: this.$stage.width() / 2,
                          y: this.$stage.height() / 2
                        }, e);
            Severity: Major
            Found in assets/js/d3photo-view.js and 1 other location - About 2 hrs to fix
            assets/js/d3photo-view.js on lines 2490..2495

            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

                      case 61:
                        this.zoom(this.options.ratioThreshold * 3, {
                          x: this.$stage.width() / 2,
                          y: this.$stage.height() / 2
                        }, e);
            Severity: Major
            Found in assets/js/d3photo-view.js and 1 other location - About 2 hrs to fix
            assets/js/d3photo-view.js on lines 2474..2479

            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

                    getNextData: function(modelId, arr) {
                        let nextModelId = this.getArrNextValue(arr, modelId);
                        if (! nextModelId) {
                            return null;
                        }
            Severity: Major
            Found in assets/js/d3files-preview.js and 1 other location - About 1 hr to fix
            assets/js/d3files-preview.js on lines 405..412

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

            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

                    getPrevData: function(modelId, arr) {
                        let prevModelId = this.getArrPrevValue(arr, modelId);
                        if (! prevModelId) {
                            return null;
                        }
            Severity: Major
            Found in assets/js/d3files-preview.js and 1 other location - About 1 hr to fix
            assets/js/d3files-preview.js on lines 397..404

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

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