File jquery-terminal.js
has 3622 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**@license
* __ _____ ________ __
* / // _ /__ __ _____ ___ __ _/__ ___/__ ___ ______ __ __ __ ___ / /
* __ / // // // // // _ // _// // / / // _ // _// // // \/ // _ \/ /
* / / // // // // // ___// / / // / / // ___// / / / / // // /\ // // / /__
Function terminal
has 1464 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.terminal = function(init_interpreter, options) {
// -----------------------------------------------------------------------
// :: helper function
// -----------------------------------------------------------------------
function get_processed_command(command) {
Function cmd
has 721 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.cmd = function(options) {
var self = this;
var maybe_data = self.data('cmd');
if (maybe_data) {
return maybe_data;
Function keydown_event
has 242 lines of code (exceeds 25 allowed). Consider refactoring. Open
function keydown_event(e) {
var result, pos, len;
if (typeof options.keydown == 'function') {
result = options.keydown(e);
if (result !== undefined) {
Function from_ansi
has 164 lines of code (exceeds 25 allowed). Consider refactoring. Open
from_ansi: (function() {
var color = {
30: 'black',
31: 'red',
32: 'green',
Function redraw
has 151 lines of code (exceeds 25 allowed). Consider refactoring. Open
var redraw = (function(self) {
var before = cursor.prev();
var after = cursor.next();
// -----------------------------------------------------------------------
// :: Draw line with the cursor
Function key_down
has 108 lines of code (exceeds 25 allowed). Consider refactoring. Open
function key_down(e) {
// Prevent to be executed by cmd: CTRL+D, TAB, CTRL+TAB (if more then
// one terminal)
var result, i, top = interpreters.top();
if ($.type(top.keydown) === 'function') {
Function make_interpreter
has 94 lines of code (exceeds 25 allowed). Consider refactoring. Open
function make_interpreter(user_interpreter, auth, finalize) {
finalize = finalize || $.noop;
var type = $.type(user_interpreter);
var result = {};
var commands;
Function format
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
format: function(str, options) {
var settings = $.extend({}, {
linksNoReferrer: false
}, options || {});
if (typeof str === 'string') {
Function split_equal
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
split_equal: function(str, length) {
var formatting = false;
var in_text = false;
var braket = 0;
var prev_format = '';
Function format_ansi
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
function format_ansi(code) {
var controls = code.split(';');
var num;
var faited = false;
var reverse = false;
Function History
has 74 lines of code (exceeds 25 allowed). Consider refactoring. Open
function History(name, size) {
var enabled = true;
var storage_key = '';
if (typeof name === 'string' && name !== '') {
storage_key = name + '_';
Function login
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
login: function(auth, infinite, success, error) {
if (in_login) {
throw new Error(strings.notWhileLogin);
}
if (typeof auth !== 'function') {
Function json_stringify
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.json_stringify = function(object, level) {
var result = '', i;
level = level === undefined ? 1 : level;
var type = typeof object;
switch (type) {
Function test
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
test: function() {
var term = $.terminal.active();
if (!term) {
term = $('body').terminal($.noop).css('margin', 0);
var margin = term.outerHeight() - term.height();
Function commands
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
function commands(command, silent, exec) {
try {
if (!ghost()) {
prev_command = $.terminal.splitCommand(command).name;
if (exec && typeof settings.historyFilter == 'function' &&
Function format
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
sprintf.format = function(parse_tree, argv) {
var cursor = 1, tree_length = parse_tree.length, node_type = '', arg, output = [], i, k, match, pad, pad_character, pad_length;
for (i = 0; i < tree_length; i++) {
node_type = get_type(parse_tree[i]);
if (node_type === 'string') {
Function add
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
add: function(element, interval, label, fn, times, belay) {
var counter = 0;
if (jQuery.isFunction(label)) {
if (!times) {
Function parse
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
sprintf.parse = function(fmt) {
var _fmt = fmt, match = [], parse_tree = [], arg_names = 0;
while (_fmt) {
if ((match = /^[^\x25]+/.exec(_fmt)) !== null) {
parse_tree.push(match[0]);
Function draw_line
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
function draw_line(string, options) {
// prevent exception in display exception
try {
var line_settings = $.extend({
raw: false,
Function focus
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
focus: function(toggle, silent) {
self.oneTime(1, function() {
if (terminals.length() === 1) {
if (toggle === false) {
try {
Consider simplifying this complex logical expression. Open
if (reverse_search && (e.which === 35 || e.which === 36 ||
e.which === 37 || e.which === 38 ||
e.which === 39 || e.which === 40 ||
e.which === 13 || e.which === 27)) {
clear_reverse_state();
Function remove
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
remove: function(element, label, fn) {
var timers = element.$timers, ret;
if (timers) {
Function flush
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
flush: function() {
try {
var wrapper;
// print all lines
$.each(output_buffer, function(i, line) {
Function make_object_interpreter
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function make_object_interpreter(object, arity, fallback) {
// function that maps commands to object methods
// it keeps terminal context
return function(user_command, terminal) {
if (user_command === '') {
Function make_json_rpc_object
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
function make_json_rpc_object(url, auth, success) {
$.jrpc(url, 'system.describe', [], function(ret) {
var commands = [];
if (ret.procs) {
var interpreter_object = {};
Function Cycle
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Cycle(init) {
var data = init ? [init] : [];
var pos = 0;
$.extend(this, {
get: function() {
Function recur
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
(function recur(interpreters, success) {
if (interpreters.length) {
var first = interpreters[0];
var rest = interpreters.slice(1);
var type = $.type(first);
Function complete_helper
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function complete_helper(command, string, commands) {
var test = command_line.get().substring(0, command_line.position());
if (test !== command) {
// command line changed between TABS - ignore
return;
Function jrpc
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.jrpc = function(url, method, params, success, error) {
ids[url] = ids[url] || 0;
var request = $.json_stringify({
'jsonrpc': '2.0', 'method': method,
'params': params, 'id': ++ids[url]});
Function pop
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
pop: function(string) {
if (string !== undefined) {
echo_command(string);
}
var token = self.token(true);
Function make_basic_json_rpc_interpreter
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function make_basic_json_rpc_interpreter(url) {
var service = function(method, params) {
self.pause();
$.jrpc(url, method, params, function(json) {
if (!json.error) {
Function parseArguments
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
parseArguments: function(string) {
return $.map(string.match(command_re) || [], function(arg) {
if (arg[0] === "'" && arg[arg.length-1] === "'") {
return arg.replace(/^'|'$/g, '');
} else if (arg[0] === '"' && arg[arg.length-1] === '"') {
Function exception
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
exception: function(e, label) {
var message = exception_message(e);
if (label) {
message = '[' + label + ']: ' + message;
}
Function push
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
push: function(interpreter, options) {
options = options || {};
options.name = options.name || prev_command;
options.prompt = options.prompt || options.name + ' ';
//names.push(options.name);
Function reverse_history_search
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function reverse_history_search(next) {
var history_data = history.data();
var regex, save_string;
var len = history_data.length;
if (next && reverse_search_position > 0) {
Consider simplifying this complex logical expression. Open
if (this.length > 1) {
return this.each(function() {
$.fn.terminal.call($(this),
init_interpreter,
$.extend({name: self.selector}, options));
Avoid deeply nested control flow statements. Open
if (match[1] == '0') {
//just closing
inside = false;
prev_color = prev_background = '';
} else {
Avoid deeply nested control flow statements. Open
if (line[j] === '&') { // treat entity as one character
var m = line.substring(j).match(/^(&[^;]+;)/);
if (!m) {
// should never happen if used by terminal, because
// it always calls $.terminal.encode before this function
Avoid deeply nested control flow statements. Open
if (last[last.length-1] !== ']') {
prev_format = last.match(format_begin_re)[1];
output_line += ']';
} else if (output_line.match(format_last_re)) {
var line_len = output_line.length;
Avoid deeply nested control flow statements. Open
if (terminals.length() > 1) {
self.focus(false);
return false;
}
Avoid deeply nested control flow statements. Open
if (arguments[i] === undef) {
match[i] = undef;
}
Avoid deeply nested control flow statements. Open
} else if (e.which === 8) { //backspace
if (reverse_search) {
reverse_search_string = reverse_search_string.slice(0, -1);
draw_reverse_prompt();
} else {
Avoid deeply nested control flow statements. Open
if (interpreters.size() > 1 ||
settings.login !== undefined) {
self.pop('');
} else {
self.resume();
Avoid deeply nested control flow statements. Open
for (var _fn in timers[label]) {
if (timers[label].hasOwnProperty(_fn)) {
window.clearInterval(timers[label][_fn]);
delete timers[label][_fn];
}
Avoid deeply nested control flow statements. Open
} else if (e.which === 34) { // PAGE DOWN
self.scroll(self.height());
} else if (e.which === 33) { // PAGE UP
self.scroll(-self.height());
} else {
Function add
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
add: function(element, interval, label, fn, times, belay) {
Avoid deeply nested control flow statements. Open
while ((replacement_field = replacement_field.substring(field_match[0].length)) !== '') {
if ((field_match = /^\.([a-z_][a-z_\d]*)/i.exec(replacement_field)) !== null) {
field_list.push(field_match[1]);
}
else if ((field_match = /^\[(\d+)\]/.exec(replacement_field)) !== null) {
Avoid deeply nested control flow statements. Open
if (rpc_count === 1) {
function_interpreter = make_basic_json_rpc_interpreter(first);
} else {
self.error(strings.oneRPCWithIgnore);
}
Avoid deeply nested control flow statements. Open
if (4 !== r.readyState) {
try {
r.abort();
} catch (error) {
self.error(strings.ajaxAbortError);
Avoid deeply nested control flow statements. Open
if (e.shiftKey) {
self.insert('\n');
} else {
if (history && command && !mask &&
((typeof options.historyFilter == 'function' &&
Avoid deeply nested control flow statements. Open
if (style.indexOf('g') !== -1) {
style_str += 'text-shadow:0 0 5px ' + color + ';';
}
Avoid deeply nested control flow statements. Open
if (match[1] != '0') {
inside = true;
output.push('[[' + code.join(';') + ']');
// store colors to next use
if (code[1]) {
Avoid deeply nested control flow statements. Open
if (function_interpreter) {
self.error(strings.oneInterpreterFunction);
} else {
function_interpreter = first;
}
Avoid deeply nested control flow statements. Open
if (!silent) {
try {
settings.onTerminalChange(self);
} catch (e) {
display_exception(e, 'onTerminalChange');
Avoid deeply nested control flow statements. Open
for (i=strings.length-1; i>0; i--) {
// treat escape space as part of the string
if (strings[i-1][strings[i-1].length-1] == '\\') {
string = strings[i-1] + ' ' + string;
} else {
Avoid deeply nested control flow statements. Open
if (num_lines === 3) {
before.before('<div>' + $.terminal.encode(array[0], true) +
'</div>');
draw_cursor_line(array[1], position-first_len-1);
after.after('<div class="clear">' +
Avoid deeply nested control flow statements. Open
if (new_object) {
$.extend(object, new_object);
}
Avoid deeply nested control flow statements. Open
} else if (type === 'object') {
$.extend(object, first);
recur(rest, success);
}
Avoid deeply nested control flow statements. Open
if (timers[label].hasOwnProperty(ret)) {
break;
}
Avoid deeply nested control flow statements. Open
if (result !== false) {
self.echo(result);
}
Avoid deeply nested control flow statements. Open
if (output_line.match(']')) {
prev_format = '';
}
Avoid deeply nested control flow statements. Open
if (!arg.hasOwnProperty(match[2][k])) {
throw(sprintf('[sprintf] property "%s" does not exist', match[2][k]));
}
Avoid deeply nested control flow statements. Open
if (fn.$timerID) {
window.clearInterval(timers[label][fn.$timerID]);
delete timers[label][fn.$timerID];
}
Avoid deeply nested control flow statements. Open
if (reverse_search_string.length !== j) {
reverse_search_string = reverse_search_string.substring(0, j);
draw_reverse_prompt();
}
Avoid deeply nested control flow statements. Open
if (result === false) {
lines = lines.slice(0, position).
concat(lines.slice(position+1));
} else {
lines = lines.slice(0, position).
Avoid deeply nested control flow statements. Open
if (matched[0].charAt(j) !== matched[i].charAt(j)) {
break loop;
}
Consider simplifying this complex logical expression. Open
if (history && command && !mask &&
((typeof options.historyFilter == 'function' &&
options.historyFilter(command)) ||
!options.historyFilter)) {
history.append(command);
Function everyTime
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
everyTime: function(interval, label, fn, times, belay) {
Function jrpc
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
$.jrpc = function(url, method, params, success, error) {
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return arg.replace(/\\ /g, ' ');
Avoid too many return
statements within this function. Open
return;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true; // CMD+l jump into Omnibox on Chrome Mac
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return parseFloat(arg);
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return true;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return false;
Similar blocks of code found in 2 locations. Consider refactoring. Open
} else {
try {
if (!silent && settings.onFocus(self) !== false) {
self.enable();
}
- Read upRead up
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 63.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (toggle === false) {
try {
if (!silent && settings.onBlur(self) !== false) {
self.disable();
}
- Read upRead up
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 63.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (_8bit_color && process_8bit && palette[num-1]) {
output_color = palette[num-1];
} else if (color[num]) {
output_color = color[num];
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (_8bit_background && process_8bit && palette[num-1]) {
output_background = palette[num-1];
} else if (background[num]) {
output_background = background[num];
}
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
visible: (function() {
var visible = self.visible;
return function() {
visible.apply(self, []);
redraw();
- Read upRead up
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 57.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
show: (function() {
var show = self.show;
return function() {
show.apply(self, []);
redraw();
- Read upRead up
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 57.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
var color = {
30: 'black',
31: 'red',
32: 'green',
33: 'yellow',
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
var background = {
40: 'black',
41: 'red',
42: 'green',
43: 'yellow',
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($.type(top.keydown) === 'function') {
result = top.keydown(e, self);
if (result !== undefined) {
return result;
}
- Read upRead up
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 53.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if ($.type(settings.keydown) === 'function') {
result = settings.keydown(e, self);
if (result !== undefined) {
return result;
}
- Read upRead up
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 53.
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
} else if (position === first_len) {
before.before(div(array[0]));
draw_cursor_line(array[1], 0);
lines_after(array.slice(2));
} else {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
} else if (position === first_len) {
before.before(div(array[0]));
draw_cursor_line(array[1], 0);
lines_after(array.slice(2));
} else {
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
token: settings.login ? function(local) {
return $.Storage.get(self.prefix_name(local) + '_token');
} : $.noop,
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
login_name: settings.login ? function(local) {
return $.Storage.get(self.prefix_name(local) + '_login');
} : $.noop,
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 6 locations. Consider refactoring. Open
normal: {
black: '#000',
red: '#A00',
green: '#008400',
yellow: '#A50',
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 6 locations. Consider refactoring. Open
faited: {
black: '#000',
red: '#640000',
green: '#006100',
yellow: '#737300',
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 6 locations. Consider refactoring. Open
bold: {
black: '#000',
red: '#F55',
green: '#44D544',
yellow: '#FF5',
- Read upRead up
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
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76