stefangabos/Zebra_Dialog

View on GitHub
src/zebra_dialog.src.js

Summary

Maintainability
F
3 days
Test Coverage

Function Zebra_Dialog has 456 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

    $.Zebra_Dialog = function() {

        // so you can tell the version number even if all you have is the minified source
        this.version = '3.0.7';

Severity: Major
Found in src/zebra_dialog.src.js - About 2 days to fix

    Function init has 216 lines of code (exceeds 25 allowed). Consider refactoring.
    Wontfix

            plugin.init = function() {
    
                var ajax_options, button_bar, buttons, canvas, $container = $('body'), default_options, iframe_options,
                    len, max_zindex = 0, spinner, $title, tmp, type;
    
    
    Severity: Major
    Found in src/zebra_dialog.src.js - About 1 day to fix

      File zebra_dialog.src.js has 461 lines of code (exceeds 250 allowed). Consider refactoring.
      Wontfix

      /**
       *  Zebra_Dialog
       *
       *  A small, compact (one JS file, no dependencies other than jQuery 1.7.0+), mobile friendly and highly configurable
       *  dialog box plugin for jQuery, meant to replace JavaScript's native "alert", "confirmation" and "prompt" dialogs.
      Severity: Minor
      Found in src/zebra_dialog.src.js - About 7 hrs to fix

        Function _draw has 100 lines of code (exceeds 25 allowed). Consider refactoring.
        Wontfix

                    _draw = function() {
        
                        var
        
                            // get the viewport width and height
        Severity: Major
        Found in src/zebra_dialog.src.js - About 4 hrs to fix

          Function close has 41 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  plugin.close = function(caption, input) {
          
                      var animation_speed = plugin.settings.animation_speed_hide,
                          backdrops = $('.ZebraDialogBackdrop'),
                          dialogs = $('.ZebraDialog'),
          Severity: Minor
          Found in src/zebra_dialog.src.js - About 1 hr to fix

            Consider simplifying this complex logical expression.
            Open

                            if (dialog_height + vertical_margin > viewport_height - (vertical_margin * 2))
            
                                // adjust the dialog box's body height so that it fits
                                plugin.body.css('height', viewport_height - (vertical_margin * 2) -
                                    ($('.ZebraDialog_Title', plugin.dialog).length ? $('.ZebraDialog_Title', plugin.dialog).outerHeight() : 0) -
            Severity: Major
            Found in src/zebra_dialog.src.js - About 1 hr to fix

              Consider simplifying this complex logical expression.
              Open

                              else if (compute_body_height)
              
                                  plugin.body.css('height', plugin.dialog.height() -
                                      ($('.ZebraDialog_Title', plugin.dialog).length ? $('.ZebraDialog_Title', plugin.dialog).outerHeight() : 0) -
                                      ($('.ZebraDialog_Buttons', plugin.dialog).length ? $('.ZebraDialog_Buttons', plugin.dialog).outerHeight() : 0) -
              Severity: Major
              Found in src/zebra_dialog.src.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                                if (
                
                                    // the position is given as an array
                                    $.isArray(plugin.settings.position) &&
                
                
                Severity: Major
                Found in src/zebra_dialog.src.js - About 40 mins to fix

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

                              if (tmp) {
                  
                                  // if "height" was specified as a percentage
                                  if (undefined !== tmp[2])
                  
                  
                  Severity: Major
                  Found in src/zebra_dialog.src.js and 1 other location - About 5 hrs to fix
                  src/zebra_dialog.src.js on lines 1014..1036

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

                  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 (tmp) {
                  
                                      // if "max_height" was specified as a percentage
                                      if (undefined !== tmp[2])
                  
                  
                  Severity: Major
                  Found in src/zebra_dialog.src.js and 1 other location - About 5 hrs to fix
                  src/zebra_dialog.src.js on lines 983..1005

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

                  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 (tmp) {
                  
                                  // if "width" was specified as a percentage
                                  if (undefined !== tmp[2])
                  
                  
                  Severity: Major
                  Found in src/zebra_dialog.src.js and 1 other location - About 5 hrs to fix
                  src/zebra_dialog.src.js on lines 960..975

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

                  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 (tmp) {
                  
                                      // if "max_width" was specified as a percentage
                                      if (undefined !== tmp[2])
                  
                  
                  Severity: Major
                  Found in src/zebra_dialog.src.js and 1 other location - About 5 hrs to fix
                  src/zebra_dialog.src.js on lines 936..951

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

                  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

                                              ajax_options = typeof plugin.settings.source[type] === 'string' ? {'url': plugin.settings.source[type]} : plugin.settings.source[type];
                  Severity: Major
                  Found in src/zebra_dialog.src.js and 1 other location - About 1 hr to fix
                  src/zebra_dialog.src.js on lines 1163..1163

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

                  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

                                              iframe_options = $.extend(default_options, typeof plugin.settings.source[type] === 'string' ? {'src': plugin.settings.source[type]} : plugin.settings.source[type]);
                  Severity: Major
                  Found in src/zebra_dialog.src.js and 1 other location - About 1 hr to fix
                  src/zebra_dialog.src.js on lines 1125..1125

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

                  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

                                  center_buttons:              false,         //  When set to TRUE, the buttons will be centered instead of
                  Severity: Minor
                  Found in src/zebra_dialog.src.js and 1 other location - About 50 mins to fix
                  src/zebra_dialog.src.js on lines 327..327

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

                  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

                                  title:                      '',             //  Title of the dialog box
                  Severity: Minor
                  Found in src/zebra_dialog.src.js and 1 other location - About 50 mins to fix
                  src/zebra_dialog.src.js on lines 122..122

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

                  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

                          plugin.update = function() {
                  
                              // clear a previously set timeout
                              // this will ensure that the next piece of code will not be executed on every step of the resize event
                              clearTimeout(timeout);
                  Severity: Minor
                  Found in src/zebra_dialog.src.js and 1 other location - About 30 mins to fix
                  src/zebra_dialog.src.js on lines 1288..1302

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

                  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

                              $(window).on('resize.ZebraDialog_' + id, function() {
                  
                                  // clear a previously set timeout
                                  // this will ensure that the next piece of code will not be executed on every step of the resize event
                                  clearTimeout(timeout);
                  Severity: Minor
                  Found in src/zebra_dialog.src.js and 1 other location - About 30 mins to fix
                  src/zebra_dialog.src.js on lines 1494..1508

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

                  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