bbottema/js-epub-maker

View on GitHub

Showing 47 of 47 total issues

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

function createTestEpub(header, preface, ch1, ch2, ch3, ch4, rn1, rn2) {
    return 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 demo/js/script.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

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

              .withSection(new EpubMaker.Section('bodymatter', 'bodymatter', { title: 'Start of the story' }, false, true)
                  .withSubSection(new EpubMaker.Section(null, 'preface', preface, true, false))
                  .withSubSection(new EpubMaker.Section(null, 'part-1', { title: 'Part 1' }, true, false)
                      .withSubSection(new EpubMaker.Section(null, 'chapter-1', ch1, true, false))
                      .withSubSection(new EpubMaker.Section(null, 'chapter-2', ch2, true, false))
      Severity: Major
      Found in demo/js/script.js and 1 other location - About 1 hr to fix
      demo/js/script.js on lines 43..52

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

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

          EpubMaker.Section = function(epubType, id, content, includeInToc, includeInLandmarks) {
              var self = this;
              this.epubType = epubType;
              this.id = id;
              this.content = content;
      Severity: Minor
      Found in src/js-epub-maker.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

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

                  function addEpub2Nav(zip, epubConfig) {
                      Handlebars.registerPartial('sectionsNCXTemplate', templates.sectionsNCXTemplate);
                      zip.folder('EPUB').file('lightnovel.ncx', compile(templates.ncx, epubConfig));
                  }
          Severity: Major
          Found in src/js/template-builders/lightnovel-builder.js and 1 other location - About 1 hr to fix
          src/js/template-builders/lightnovel-builder.js on lines 116..119

          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

          Function createTestEpub has 8 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          function createTestEpub(header, preface, ch1, ch2, ch3, ch4, rn1, rn2) {
          Severity: Major
          Found in src/test/test-script.js - About 1 hr to fix

            Function createTestEpub has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            function createTestEpub(header, preface, ch1, ch2, ch3, ch4, rn1, rn2) {
            Severity: Major
            Found in demo/js/script.js - About 1 hr to fix

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

                      function addEpub3Nav(zip, epubConfig) {
                          Handlebars.registerPartial('sectionsNavTemplate', templates.sectionsNavTemplate);
                          zip.folder('EPUB').file('nav.html', compile(templates.nav, epubConfig));
                      }
              Severity: Major
              Found in src/js/template-builders/lightnovel-builder.js and 1 other location - About 1 hr to fix
              src/js/template-builders/lightnovel-builder.js on lines 111..114

              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

              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

                                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

                    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

                      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 Section has 5 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            EpubMaker.Section = function(epubType, id, content, includeInToc, includeInLandmarks) {
                        Severity: Minor
                        Found in src/js-epub-maker.js - About 35 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

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

                                        for(var i = 0; i < epubConfig.sections.length; i++) {
                                            addSection(zip, epubConfig.sections[i]);
                                        }
                            Severity: Minor
                            Found in src/js/template-builders/lightnovel-builder.js and 1 other location - About 35 mins to fix
                            src/js/template-builders/lightnovel-builder.js on lines 171..173

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

                            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

                                    function addManifestOpf(zip, epubConfig) {
                                        zip.folder('EPUB').file(epubConfig.slug + '.opf', compile(templates.opf, epubConfig));
                                    }
                            Severity: Minor
                            Found in src/js/template-builders/idpf-wasteland-builder.js and 2 other locations - About 35 mins to fix
                            src/js/template-builders/idpf-wasteland-builder.js on lines 74..76
                            src/js/template-builders/idpf-wasteland-builder.js on lines 78..80

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

                            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

                                    function addEpub3Nav(zip, epubConfig) {
                                        zip.folder('EPUB').file(epubConfig.slug + '-nav.xhtml', compile(templates.nav, epubConfig));
                                    }
                            Severity: Minor
                            Found in src/js/template-builders/idpf-wasteland-builder.js and 2 other locations - About 35 mins to fix
                            src/js/template-builders/idpf-wasteland-builder.js on lines 51..53
                            src/js/template-builders/idpf-wasteland-builder.js on lines 74..76

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

                            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

                                        for(var i = 0; i < section.subSections.length; i++) {
                                            addSection(zip, section.subSections[i]);
                                        }
                            Severity: Minor
                            Found in src/js/template-builders/lightnovel-builder.js and 1 other location - About 35 mins to fix
                            src/js/template-builders/lightnovel-builder.js on lines 177..179

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

                            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

                            Severity
                            Category
                            Status
                            Source
                            Language