antimalware/manul

View on GitHub
src/scanner/static/js/bootbox.js

Summary

Maintainability
F
6 days
Test Coverage

Function init has 541 lines of code (exceeds 25 allowed). Consider refactoring.
Open

}(this, function init($, undefined) {

  "use strict";

  // the base DOM structure needed to create a modal
Severity: Major
Found in src/scanner/static/js/bootbox.js - About 2 days to fix

    Function init has a Cognitive Complexity of 91 (exceeds 5 allowed). Consider refactoring.
    Open

    }(this, function init($, undefined) {
    
      "use strict";
    
      // the base DOM structure needed to create a modal
    Severity: Minor
    Found in src/scanner/static/js/bootbox.js - About 1 day 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

    File bootbox.js has 553 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * bootbox.js [master branch]
     *
     * http://bootboxjs.com/license.txt
     */
    Severity: Major
    Found in src/scanner/static/js/bootbox.js - About 1 day to fix

      Function prompt has 141 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        exports.prompt = function() {
          var options;
          var defaults;
          var dialog;
          var form;
      Severity: Major
      Found in src/scanner/static/js/bootbox.js - About 5 hrs to fix

        Function dialog has 79 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          exports.dialog = function(options) {
            options = sanitize(options);
        
            var dialog = $(templates.dialog);
            var innerDialog = dialog.find(".modal-dialog");
        Severity: Major
        Found in src/scanner/static/js/bootbox.js - About 3 hrs to fix

          Function sanitize has 36 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            function sanitize(options) {
              var buttons;
              var total;
          
              if (typeof options !== "object") {
          Severity: Minor
          Found in src/scanner/static/js/bootbox.js - About 1 hr to fix

            There are no issues that match your filters.

            Category
            Status