bbottema/js-epub-maker

View on GitHub
demo/js/vendor/beautify-html.js

Summary

Maintainability
F
1 wk
Test Coverage

Function Beautifier has 799 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function Beautifier(html_source, options, js_beautify, css_beautify) {
    //Wrapper function to invoke all the necessary constructors and deal with the output.
    html_source = html_source || '';

    var multi_parser,
Severity: Major
Found in demo/js/vendor/beautify-html.js - About 3 days to fix

    Function Parser has 587 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function Parser() {
    
            this.pos = 0; //Parser position
            this.token = '';
            this.current_mode = 'CONTENT'; //reflects the current Parser mode: TAG/CONTENT
    Severity: Major
    Found in demo/js/vendor/beautify-html.js - About 2 days to fix

      File beautify-html.js has 887 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      /*jshint curly:false, eqeqeq:true, laxbreak:true, noempty:false */
      /* AUTO-GENERATED. DO NOT MODIFY. */
      /*
      
        The MIT License (MIT)
      Severity: Major
      Found in demo/js/vendor/beautify-html.js - About 2 days to fix

        Function get_tag has 197 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                this.get_tag = function(peek) { //function to get a full tag and parse its type
                    var input_char = '',
                        content = [],
                        comment = '',
                        space = false,
        Severity: Major
        Found in demo/js/vendor/beautify-html.js - About 7 hrs to fix

          Function beautify has 135 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              this.beautify = function() {
                  multi_parser = new Parser(); //wrapping functions Parser
                  multi_parser.printer(html_source, indent_character, indent_size, wrap_line_length, brace_style); //initialize starting values
                  while (true) {
                      var t = multi_parser.get_token();
          Severity: Major
          Found in demo/js/vendor/beautify-html.js - About 5 hrs to fix

            Function printer has 68 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    this.printer = function(js_source, indent_character, indent_size, wrap_line_length, brace_style) { //handles input/output and some other printing functions
            
                        this.input = js_source || ''; //gets the input for the Parser
            
                        // HACK: newline parsing inconsistent. This brute force normalizes the input.
            Severity: Major
            Found in demo/js/vendor/beautify-html.js - About 2 hrs to fix

              Function get_comment has 45 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      this.get_comment = function(start_pos) { //function to return comment content in its entirety
                          // this is will have very poor perf, but will work for now.
                          var comment = '',
                              delimiter = '>',
                              matched = false;
              Severity: Minor
              Found in demo/js/vendor/beautify-html.js - About 1 hr to fix

                Function get_content has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        this.get_content = function() { //function to capture regular content between tags
                            var input_char = '',
                                content = [],
                                handlebarsStarted = 0;
                
                
                Severity: Minor
                Found in demo/js/vendor/beautify-html.js - About 1 hr to fix

                  Function get_unformatted has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          this.get_unformatted = function(delimiter, orig_tag) { //function to return unformatted content in its entirety
                              if (orig_tag && orig_tag.toLowerCase().indexOf(delimiter) !== -1) {
                                  return '';
                              }
                              var input_char = '';
                  Severity: Minor
                  Found in demo/js/vendor/beautify-html.js - About 1 hr to fix

                    Function get_token has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            this.get_token = function() { //initial handler for token-retrieval
                                var token;
                    
                                if (this.last_token === 'TK_TAG_SCRIPT' || this.last_token === 'TK_TAG_STYLE') { //check if we need to format javascript
                                    var type = this.last_token.substr(7);
                    Severity: Minor
                    Found in demo/js/vendor/beautify-html.js - About 1 hr to fix

                      Avoid deeply nested control flow statements.
                      Open

                                                  if (multi_parser.output[lastCheckedOutput].match(/{{#if/)) {
                                                      foundIfOnCurrentLine = true;
                                                      break;
                                                  }
                      Severity: Major
                      Found in demo/js/vendor/beautify-html.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    } else if (tag_check.charAt(0) === '!') { //peek for <! comment
                                        // for comments content is already correct.
                                        if (!peek) {
                                            this.tag_type = 'SINGLE';
                                            this.traverse_whitespace();
                        Severity: Major
                        Found in demo/js/vendor/beautify-html.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                          if (!peek) {
                                              this.record_tag(tag_check);
                                              this.tag_type = 'STYLE';
                                          }
                          Severity: Major
                          Found in demo/js/vendor/beautify-html.js - About 45 mins to fix

                            Avoid deeply nested control flow statements.
                            Open

                                                        if (content[i] === ' ') {
                                                            first_attr = false;
                                                            break;
                                                        }
                            Severity: Major
                            Found in demo/js/vendor/beautify-html.js - About 45 mins to fix

                              Consider simplifying this complex logical expression.
                              Open

                                              if (content.length && content[content.length - 1] !== '=' && input_char !== '>' && space) {
                                                  //no space after = or before >
                                                  var wrapped = this.space_or_wrap(content);
                                                  var indentAttrs = wrapped && input_char !== '/' && !is_wrap_attributes_force;
                                                  space = false;
                              Severity: Major
                              Found in demo/js/vendor/beautify-html.js - About 40 mins to fix

                                Function printer has 5 arguments (exceeds 4 allowed). Consider refactoring.
                                Open

                                        this.printer = function(js_source, indent_character, indent_size, wrap_line_length, brace_style) { //handles input/output and some other printing functions
                                Severity: Minor
                                Found in demo/js/vendor/beautify-html.js - About 35 mins to fix

                                  Avoid too many return statements within this function.
                                  Open

                                                      return token;
                                  Severity: Major
                                  Found in demo/js/vendor/beautify-html.js - About 30 mins to fix

                                    Avoid too many return statements within this function.
                                    Open

                                                        return [token, tag_name_type];
                                    Severity: Major
                                    Found in demo/js/vendor/beautify-html.js - About 30 mins to fix

                                      Avoid too many return statements within this function.
                                      Open

                                          return code >= 0xaa && nonASCIIidentifierStart.test(String.fromCharCode(code));
                                      Severity: Major
                                      Found in demo/js/vendor/beautify-html.js - About 30 mins to fix

                                        Avoid too many return statements within this function.
                                        Open

                                            if (code < 97) return code === 95;
                                        Severity: Major
                                        Found in demo/js/vendor/beautify-html.js - About 30 mins to fix

                                          Avoid too many return statements within this function.
                                          Open

                                              if (code < 123) return true;
                                          Severity: Major
                                          Found in demo/js/vendor/beautify-html.js - About 30 mins to fix

                                            Avoid too many return statements within this function.
                                            Open

                                                return code >= 0xaa && nonASCIIidentifier.test(String.fromCharCode(code));
                                            Severity: Major
                                            Found in demo/js/vendor/beautify-html.js - About 30 mins to fix

                                              There are no issues that match your filters.

                                              Category
                                              Status