camdub/Internships

View on GitHub
public/javascripts/tinyeditor/themes/advanced/editor_template_src.js

Summary

Maintainability
F
1 wk
Test Coverage

File editor_template_src.js has 999 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/**
 * editor_template_src.js
 *
 * Copyright 2009, Moxiecode Systems AB
 * Released under LGPL License.
Severity: Major
Found in public/javascripts/tinyeditor/themes/advanced/editor_template_src.js - About 2 days to fix

    Function _nodeChanged has 187 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            _nodeChanged : function(ed, cm, n, co, ob) {
                var t = this, p, de = 0, v, c, s = t.settings, cl, fz, fn, fc, bc, formatNames, matches;
    
                tinymce.each(t.stateControls, function(c) {
                    cm.setActive(c, ed.queryCommandState(t.controls[c][1]));
    Severity: Major
    Found in public/javascripts/tinyeditor/themes/advanced/editor_template_src.js - About 7 hrs to fix

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

              init : function(ed, url) {
                  var t = this, s, v, o;
          
                  t.editor = ed;
                  t.url = url;
      Severity: Major
      Found in public/javascripts/tinyeditor/themes/advanced/editor_template_src.js - About 3 hrs to fix

        Function renderUI has 64 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                renderUI : function(o) {
                    var n, ic, tb, t = this, ed = t.editor, s = t.settings, sc, p, nl;
        
                    if (ed.settings) {
                        ed.settings.aria_label = s.aria_label + ed.getLang('advanced.help_shortcut');
        Severity: Major
        Found in public/javascripts/tinyeditor/themes/advanced/editor_template_src.js - About 2 hrs to fix

          Function _createStyleSelect has 61 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  _createStyleSelect : function(n) {
                      var t = this, ed = t.editor, ctrlMan = ed.controlManager, ctrl;
          
                      // Setup style select box
                      ctrl = ctrlMan.createListBox('styleselect', {
          Severity: Major
          Found in public/javascripts/tinyeditor/themes/advanced/editor_template_src.js - About 2 hrs to fix

            Function _addStatusBar has 58 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    _addStatusBar : function(tb, o) {
                        var n, t = this, ed = t.editor, s = t.settings, r, mf, me, td;
            
                        n = DOM.add(tb, 'tr');
                        n = td = DOM.add(n, 'td', {'class' : 'mceStatusbar'}); 
            Severity: Major
            Found in public/javascripts/tinyeditor/themes/advanced/editor_template_src.js - About 2 hrs to fix

              Function _simpleLayout has 47 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      _simpleLayout : function(s, tb, o, p) {
                          var t = this, ed = t.editor, lo = s.theme_advanced_toolbar_location, sl = s.theme_advanced_statusbar_location, n, ic, etb, c;
              
                          if (s.readonly) {
                              n = DOM.add(tb, 'tr');

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

                        _createFontSizeSelect : function() {
                            var t = this, ed = t.editor, c, i = 0, cl = [];
                
                            c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
                                var cur = c.items[c.selectedIndex];

                  Function onselect has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                              c = ed.controlManager.createListBox('fontsizeselect', {title : 'advanced.font_size', onselect : function(v) {
                                  var cur = c.items[c.selectedIndex];
                  
                                  if (!v && cur) {
                                      cur = cur.value;

                    Function _createBlockFormats has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            _createBlockFormats : function() {
                                var c, fmts = {
                                    p : 'advanced.paragraph',
                                    address : 'advanced.address',
                                    pre : 'advanced.pre',

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

                              _rowLayout : function(s, tb, o) {
                                  var t = this, ed = t.editor, dc, da, cf = ed.controlManager, n, ic, to, a;
                      
                                  dc = s.theme_advanced_containers_default_class || '';
                                  da = s.theme_advanced_containers_default_align || 'center';

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

                                _nodeChanged : function(ed, cm, n, co, ob) {
                        Severity: Minor
                        Found in public/javascripts/tinyeditor/themes/advanced/editor_template_src.js - About 35 mins to fix

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

                                  _createBackColorMenu : function() {
                                      var c, t = this, s = t.settings, o = {}, v;
                          
                                      if (s.theme_advanced_more_colors) {
                                          o.more_colors_func = function() {
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 443..470

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

                          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

                                  _createForeColorMenu : function() {
                                      var c, t = this, s = t.settings, o = {}, v;
                          
                                      if (s.theme_advanced_more_colors) {
                                          o.more_colors_func = function() {
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 472..499

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

                          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

                                  _mceInsertAnchor : function(ui, v) {
                                      var ed = this.editor;
                          
                                      ed.windowManager.open({
                                          url : this.url + '/anchor.htm',
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 1308..1319

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

                          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

                                  _mceLink : function(ui, val) {
                                      var ed = this.editor;
                          
                                      ed.windowManager.open({
                                          url : this.url + '/link.htm',
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 1207..1218

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

                          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

                                  _mceForeColor : function() {
                                      var t = this;
                          
                                      this._mceColorPicker(0, {
                                          color: t.fgColor,
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 1342..1352

                          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

                                  _mceBackColor : function() {
                                      var t = this;
                          
                                      this._mceColorPicker(0, {
                                          color: t.bgColor,
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 1330..1340

                          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

                                  _mceShortcuts : function() {
                                      var ed = this.editor;
                                      ed.windowManager.open({
                                          url: this.url + '/shortcuts.htm',
                                          width: 480,
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 1233..1244

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

                          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

                                          function updateColor(controlId, color) {
                                              if (c = cm.get(controlId)) {
                                                  if (!color)
                                                      color = c.settings.default_color;
                                                  if (color !== c.value) {
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 1071..1079

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

                          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

                                  _mceHelp : function() {
                                      var ed = this.editor;
                          
                                      ed.windowManager.open({
                                          url : this.url + '/about.htm',
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 1246..1256

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

                          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

                                          function updateColor(controlId, color) {
                                              if (c = cm.get(controlId)) {
                                                  if (!color)
                                                      color = c.settings.default_color;
                                                  if (color !== c.value) {
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 1057..1065

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

                          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

                                                  DOM.add(co, 'div', {id : id + '_progress', 'class' : 'mceProgress', style : {left : tb.clientWidth / 2, top : tb.clientHeight / 2}});
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 151..151

                          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

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

                                                  DOM.add(co, 'div', {id : id + '_blocker', 'class' : 'mceBlocker', style : {width : tb.clientWidth + 2, height : tb.clientHeight + 2}});
                          public/javascripts/tinyeditor/themes/advanced/editor_template_src.js on lines 152..152

                          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

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

                                  getInfo : function() {
                                      return {
                                          longname : 'Advanced theme',
                                          author : 'Moxiecode Systems AB',
                                          authorurl : 'http://tinymce.moxiecode.com',
                          public/javascripts/tinyeditor/themes/simple/editor_template_src.js on lines 73..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 50.

                          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