amtgard/ORK3

View on GitHub
orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js

Summary

Maintainability
F
1 wk
Test Coverage

Function sceditorBBCodePlugin has 343 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    $.sceditorBBCodePlugin = function(element, options) {
        var base = this;

        /**
         * Private methods
Severity: Major
Found in orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js - About 1 day to fix

    File jquery.sceditor.bbcode.js has 727 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /**
     * SCEditor BBCode Plugin v1.3.3
     * http://www.samclarke.com/2011/07/sceditor/ 
     *
     * Copyright (C) 2011-2012, Sam Clarke (samclarke.com)
    Severity: Major
    Found in orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js - About 1 day to fix

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

              base.elementToBbcode = function($element) {
                  return (function toBBCode(node, vChildren) {
                      var ret = '';
      
                      $.sceditor.dom.traverse(node, function(node) {
      Severity: Minor
      Found in orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js - About 1 hr to fix

        Function toBBCode has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    return (function toBBCode(node, vChildren) {
                        var ret = '';
        
                        $.sceditor.dom.traverse(node, function(node) {
                            var    $node        = $(node),
        Severity: Minor
        Found in orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js - About 1 hr to fix

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

                  base.getTextHandler = function(text, isPaste) {
                      var    oldText, replaceBBCodeFunc,
                          bbcodeRegex = /\[([^\[\s=]*?)(?:([^\[]*?))?\]((?:[\s\S(?!=\[\\\1)](?!\[\1))*?)\[\/(\1)\]/g,
                          atribsRegex = /(\S+)=((?:(?:(["'])(?:\\\3|[^\3])*?\3))|(?:[^'"\s]+))/g;
          
          
          Severity: Minor
          Found in orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js - About 1 hr to fix

            Function setCommand has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                $.sceditorBBCodePlugin.setCommand = function(name, tags, styles, format, html, allowsEmpty) {
            Severity: Minor
            Found in orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js - About 45 mins to fix

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

                              if(typeof base.bbcodes[bbcode].styles !== "undefined")
                                  $.each(base.bbcodes[bbcode].styles, function(style, values) {
                                      var isBlock = !!base.bbcodes[bbcode].isBlock;
                                      stylesToBbcodes[isBlock] = (stylesToBbcodes[isBlock] || {});
                                      stylesToBbcodes[isBlock][style] = (stylesToBbcodes[isBlock][style] || {});
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 155..161

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

              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(typeof base.bbcodes[bbcode].tags !== "undefined")
                                  $.each(base.bbcodes[bbcode].tags, function(tag, values) {
                                      var isBlock = !!base.bbcodes[bbcode].isBlock;
                                      tagsToBbcodes[tag] = (tagsToBbcodes[tag] || {});
                                      tagsToBbcodes[tag][isBlock] = (tagsToBbcodes[tag][isBlock] || {});
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 163..169

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

              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(node && node.nodeName.toLowerCase() === "div")
                              {
                                  while((next = node.firstChild))
                                      outputDiv.insertBefore(next, node);
              
              
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 551..560

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

              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(node && node.nodeName.toLowerCase() === "div")
                              {
                                  while((next = node.firstChild))
                                      outputDiv.insertBefore(next, node);
                                  
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 563..572

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

              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

                              link: { txtExec: function() {
                                  var    url    = prompt(this._("Enter the links URL:"), "http://"),
                                      text    = prompt(this._("Enter the displayed text:"), url) || url;
                                  
                                  if(url)
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 117..123

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

              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

                              email: { txtExec: function() {
                                  var    email    = prompt(this._("Enter the e-mail address:"), "@"),
                                      text    = prompt(this._("Enter the displayed text:"), email) || email;
                                  
                                  if(email)
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 124..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 89.

              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($.isFunction(base.bbcodes[bbcode].format))
                                      content = base.bbcodes[bbcode].format.call(base, element, content);
                                  else
                                      content = formatString(base.bbcodes[bbcode].format, content);
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 225..228

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

              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($.isFunction(base.bbcodes[bbcode].format))
                                          content = base.bbcodes[bbcode].format.call(base, element, content);
                                      else
                                          content = formatString(base.bbcodes[bbcode].format, content);
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 284..287

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

              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

                          return args[0].replace(/\{(\d+)\}/g, function(str, p1) {
                              return typeof args[p1-0+1] !== "undefined"? 
                                      args[p1-0+1] :
                                      '{' + p1 + '}';
                          });
              orkui/template/default/script/js/SCEditor/jquery.sceditor.js on lines 1011..1015

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

              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((element[0].childNodes.length === 0 || element[0].childNodes[0].nodeName.toLowerCase() === "br") &&
                                      !base.bbcodes[bbcode].allowsEmpty)
                                      return;
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 254..256

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

              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((element[0].childNodes.length === 0 || element[0].childNodes[0].nodeName.toLowerCase() === "br") &&
                                      !base.bbcodes[bbcode].allowsEmpty)
                                      return;
              orkui/template/default/script/js/SCEditor/jquery.sceditor.bbcode.js on lines 220..222

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

              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

                          text = text.replace(/&/g, "&")
                                  .replace(/</g, "&lt;")
                                  .replace(/>/g, "&gt;")
                                  .replace(/\r/g, "")
                                  .replace(/(\[\/?(?:left|center|right|justify)\])\n/g, "$1")
              orkui/template/default/script/js/SCEditor/jquery.sceditor.js on lines 656..661

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

              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

                  $.fn.sceditorBBCodePlugin = function(options) {
                      return this.each(function() {
                          (new $.sceditorBBCodePlugin(this, options));
                      });
                  };
              orkui/template/default/script/js/SCEditor/jquery.sceditor.js on lines 2505..2509

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

              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

                  $.sceditorBBCodePlugin.commandExists = function(name) {
                      return typeof $.sceditorBBCodePlugin.bbcodes[name] !== "undefined";
                  };
              orkui/template/default/script/js/SCEditor/jquery.sceditor.js on lines 2366..2368

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

              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