canax/request

View on GitHub
doc/api/js/jquery.iviewer.js

Summary

Maintainability
F
4 days
Test Coverage

File jquery.iviewer.js has 700 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
 * iviewer Widget for jQuery UI
 * https://github.com/can3p/iviewer
 *
 * Copyright (c) 2009 - 2012 Dmitry Petrov
Severity: Major
Found in doc/api/js/jquery.iviewer.js - About 1 day to fix

    Function _create has 70 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        _create: function() {
            var me = this;
    
            //drag variables
            this.dx = 0;
    Severity: Major
    Found in doc/api/js/jquery.iviewer.js - About 2 hrs to fix

      Function setImageProps has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          this.setImageProps = function(disp_w, disp_h, x, y, skip_animation, complete) {
              complete = complete || jQuery.noop;
      
              this.display_width(disp_w);
              this.display_height(disp_h);
      Severity: Minor
      Found in doc/api/js/jquery.iviewer.js - About 1 hr to fix

        Function set_zoom has 46 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            set_zoom: function(new_zoom, skip_animation, zoom_center)
            {
                if (this._trigger('onZoom', 0, new_zoom) == false) {
                    return;
                }
        Severity: Minor
        Found in doc/api/js/jquery.iviewer.js - About 1 hr to fix

          Function setImageProps has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              this.setImageProps = function(disp_w, disp_h, x, y, skip_animation, complete) {
          Severity: Minor
          Found in doc/api/js/jquery.iviewer.js - About 45 mins to fix

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

                this.y = setter(function(val, skipCss) {
                        this._y = val;
                        if (!skipCss) {
                            this._finishAnimation();
                            this._img.css("top",this._y - (this._swapDimensions ? this.display_diff() / 2 : 0) + "px");
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 3 hrs to fix
            doc/api/js/jquery.iviewer.js on lines 965..974

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

            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

                this.x = setter(function(val, skipCss) {
                        this._x = val;
                        if (!skipCss) {
                            this._finishAnimation();
                            this._img.css("left",this._x + (this._swapDimensions ? this.display_diff() / 2 : 0) + "px");
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 3 hrs to fix
            doc/api/js/jquery.iviewer.js on lines 983..992

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

            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

                    if(this.img_object.display_width() <= this.options.width){
                        x = -(this.img_object.display_width() - this.options.width)/2;
                    }
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 1 hr to fix
            doc/api/js/jquery.iviewer.js on lines 477..479

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

            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

                    if(this.img_object.display_height() <= this.options.height){
                        y = -(this.img_object.display_height() - this.options.height)/2;
                    }
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 1 hr to fix
            doc/api/js/jquery.iviewer.js on lines 474..476

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

            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

                    if(x + this.img_object.display_width() < this.options.width){
                        x = this.options.width - this.img_object.display_width();
                    }
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 1 hr to fix
            doc/api/js/jquery.iviewer.js on lines 468..470

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

            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

                    if(y + this.img_object.display_height() < this.options.height){
                        y = this.options.height - this.img_object.display_height();
                    }
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 1 hr to fix
            doc/api/js/jquery.iviewer.js on lines 471..473

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

            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

                    $("<div>", { 'class': "iviewer_rotate_left iviewer_common iviewer_button"})
                                .bind('mousedown touchstart',function(){me.angle(-90); return false;})
                                .appendTo(this.container);
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 1 hr to fix
            doc/api/js/jquery.iviewer.js on lines 818..820

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

            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

                    $("<div>", { 'class': "iviewer_zoom_out iviewer_common iviewer_button"})
                                .bind('mousedown touchstart',function(){me.zoom_by(- 1); return false;})
                                .appendTo(this.container);
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 1 hr to fix
            doc/api/js/jquery.iviewer.js on lines 833..835

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

            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

                    $("<div>", { 'class': "iviewer_zoom_zero iviewer_common iviewer_button"})
                                .bind('mousedown touchstart',function(){me.set_zoom(100); return false;})
                                .appendTo(this.container);
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 2 other locations - About 55 mins to fix
            doc/api/js/jquery.iviewer.js on lines 814..816
            doc/api/js/jquery.iviewer.js on lines 837..839

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

            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

                    $("<div>", { 'class': "iviewer_zoom_in iviewer_common iviewer_button"})
                                .bind('mousedown touchstart',function(){me.zoom_by(1); return false;})
                                .appendTo(this.container);
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 2 other locations - About 55 mins to fix
            doc/api/js/jquery.iviewer.js on lines 822..824
            doc/api/js/jquery.iviewer.js on lines 837..839

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

            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

                    $("<div>", { 'class': "iviewer_rotate_right iviewer_common iviewer_button" })
                                .bind('mousedown touchstart',function(){me.angle(90); return false;})
                                .appendTo(this.container);
            Severity: Major
            Found in doc/api/js/jquery.iviewer.js and 2 other locations - About 55 mins to fix
            doc/api/js/jquery.iviewer.js on lines 814..816
            doc/api/js/jquery.iviewer.js on lines 822..824

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

            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 0: return { x: this.x() + point.x, y: this.y() + point.y }
            Severity: Minor
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 40 mins to fix
            doc/api/js/jquery.iviewer.js on lines 1045..1045

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

            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 180: return { x: this.display_width() - point.x, y: this.display_height() - point.y }
            Severity: Minor
            Found in doc/api/js/jquery.iviewer.js and 1 other location - About 40 mins to fix
            doc/api/js/jquery.iviewer.js on lines 1061..1061

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

            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

            There are no issues that match your filters.

            Category
            Status