Showing 168 of 168 total issues
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 noty
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
window.noty = function noty(options) {
// This is for BC - Will be deleted on v2.2.0
var using_old = 0
, old_to_new = {
Function noty
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
window.noty = function noty(options) {
// This is for BC - Will be deleted on v2.2.0
var using_old = 0
, old_to_new = {
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Function date
has 75 lines of code (exceeds 25 allowed). Consider refactoring. Open
humanize.date = function(format, timestamp) {
var jsdate = ((timestamp === undefined) ? new Date() : // Not provided
(timestamp instanceof Date) ? new Date(timestamp) : // JS Date()
new Date(timestamp * 1000) // UNIX timestamp (auto-convert to int)
);
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 + '_';
File humanize_duration.js
has 286 lines of code (exceeds 250 allowed). Consider refactoring. Open
// HumanizeDuration.js - http://git.io/j0HgmQ
(function() {
var UNITS = {
Similar blocks of code found in 2 locations. Consider refactoring. Open
Configs.save(config, function(response) {
if (Response.valid(response)){ // Checks if response is valid
Notification.success('Yay! Memcached config updated with success.');
// Refreshing list
- 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 88.
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
Key.delete({key: pair.key}, function(response) {
if (Response.valid(response)){ // Checks if response is valid
Notification.info('Yay! Key deleted with success.');
// Refreshing list
- 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 88.
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
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' &&
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (timeDiff < 3600 && timeDiff > -3600) {
return (timeDiff >= 0 ? Math.floor(timeDiff / 60) + ' minutes ago' : 'in ' + Math.floor(-timeDiff / 60) + ' minutes');
}
- 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 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
- 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 (timeDiff < 86400 && timeDiff > -86400) {
return (timeDiff >= 0 ? Math.floor(timeDiff / 3600) + ' hours ago' : 'in ' + Math.floor(-timeDiff / 3600) + ' hours');
}
- 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 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
- 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
Function close
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
close:function () {
if (this.closed) return;
if (this.$bar && this.$bar.hasClass('i-am-closing-now')) return;
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 relativeTime
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
humanize.relativeTime = function(timestamp) {
timestamp = (timestamp === undefined) ? humanize.time() : timestamp;
var currTime = humanize.time();
var timeDiff = currTime - timestamp;
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]);