bbottema/js-epub-maker

View on GitHub

Showing 47 of 47 total issues

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 Builder has 154 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              var Builder = function() {
          
                  this.make = function(epubConfig) {
                      console.debug('building epub', epubConfig);
                      var zip = new JSZip();
          Severity: Major
          Found in src/js/template-builders/lightnovel-builder.js - About 6 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

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

                      function compile(template, content, skipFormatting) {
                          return formatHTML(Handlebars.compile(template)(content));
              
                          function formatHTML(htmlstr) {
                              /*jslint camelcase:false*/
              Severity: Major
              Found in src/js/template-builders/lightnovel-builder.js and 1 other location - About 3 hrs to fix
              src/js/template-builders/idpf-wasteland-builder.js on lines 109..128

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

              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

                      function compile(template, content, skipFormatting) {
                          return formatHTML(Handlebars.compile(template)(content));
                          
                          function formatHTML(htmlstr) {
                              /*jslint camelcase:false*/
              Severity: Major
              Found in src/js/template-builders/idpf-wasteland-builder.js and 1 other location - About 3 hrs to fix
              src/js/template-builders/lightnovel-builder.js on lines 182..201

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

              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 EpubMaker has 96 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var EpubMaker = function () {
                      var self = this;
                      var epubConfig = { toc: [], landmarks: [], sections: [], stylesheet: {}, additionalFiles: [], options: {} };
              
                      this.withUuid = function(uuid) {
              Severity: Major
              Found in src/js-epub-maker.js - About 3 hrs to fix

                Function Builder has 91 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var Builder = function() {
                        
                        this.make = function(epubConfig) {
                            console.debug('building epub', epubConfig);
                            var zip = new JSZip();
                Severity: Major
                Found in src/js/template-builders/idpf-wasteland-builder.js - About 3 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

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

                        return new EpubMaker()
                            .withUuid('github.com/bbottema/js-epub-maker::it-came-from::example-using-idpf-wasteland')
                            .withTemplate('idpf-wasteland')
                            .withAuthor('T. Est')
                            .withLanguage('en-GB')
                    Severity: Major
                    Found in demo/js/script.js and 1 other location - About 2 hrs to fix
                    src/test/test-script.js on lines 21..57

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

                    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

                        new EpubMaker()
                            .withUuid('github.com/bbottema/js-epub-maker::it-came-from::example-using-idpf-wasteland')
                            .withTemplate('idpf-wasteland')
                            .withAuthor('T. Est')
                            .withLanguage('en-GB')
                    Severity: Major
                    Found in src/test/test-script.js and 1 other location - About 2 hrs to fix
                    demo/js/script.js on lines 24..59

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

                    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

                        if (typeof module !== 'undefined') {
                            module.exports.builder = new Builder();
                        }
                        else if (typeof exports !== 'undefined') {
                            exports.builder = new Builder();
                    Severity: Major
                    Found in src/js/template-builders/idpf-wasteland-builder.js and 1 other location - About 2 hrs to fix
                    src/js/template-builders/lightnovel-builder.js on lines 205..211

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

                    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

                        if(typeof module !== 'undefined') {
                            module.exports.builder = new Builder();
                        } else if(typeof exports !== 'undefined') {
                            exports.builder = new Builder();
                        } else if(typeof window === 'undefined') {
                    Severity: Major
                    Found in src/js/template-builders/lightnovel-builder.js and 1 other location - About 2 hrs to fix
                    src/js/template-builders/idpf-wasteland-builder.js on lines 132..140

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

                    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

                                if (epubConfig.stylesheet.url) {
                                    return ajax(epubConfig.stylesheet.url).then(function(result) {
                                        epubConfig.styles = result.data;
                                        compileAndAddCss();
                                    });
                    Severity: Major
                    Found in src/js/template-builders/idpf-wasteland-builder.js and 1 other location - About 2 hrs to fix
                    src/js/template-builders/lightnovel-builder.js on lines 123..130

                    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

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

                                if(epubConfig.stylesheet.url) {
                                    return ajax(epubConfig.stylesheet.url).then(function(result) {
                                        epubConfig.styles = result.data;
                                        compileAndAddCss();
                                    });
                    Severity: Major
                    Found in src/js/template-builders/lightnovel-builder.js and 1 other location - About 2 hrs to fix
                    src/js/template-builders/idpf-wasteland-builder.js on lines 84..91

                    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

                    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 createTestEpub has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        function createTestEpub(header, preface, ch1, ch2, ch3, ch4, rn1, rn2) {
                            new EpubMaker()
                                .withUuid('github.com/bbottema/js-epub-maker::it-came-from::example-using-idpf-wasteland')
                                .withTemplate('idpf-wasteland')
                                .withAuthor('T. Est')
                        Severity: Minor
                        Found in src/test/test-script.js - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language