File best-globals.js
has 615 lines of code (exceeds 250 allowed). Consider refactoring. Open
"use strict";
(function codenautasModuleDefinition(root, name, factory) {
/* global define */
/* istanbul ignore next */
Function TimeInterval
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
bestGlobals.TimeInterval = function TimeInterval(timePack){
/* istanbul ignore next */
if(typeof timePack === 'number'){
timePack={ms:timePack};
console.log('|-----------------------------|');
Consider simplifying this complex logical expression. Open
if(h<0 || m<0 || s<0 || ms<0 || h>23 || m>59 || s>59 || ms>999 || micros<0 || micros>999) { return false; }
Function forOrder
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
bestGlobals.forOrder = function forOrder(text){
if(text==null){
return 'zzz(null)';
}
if(text instanceof Date){
Function changing
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
bestGlobals.changing = function changing(original, changes){
var opts = bestGlobals.changing.retreiveOptions(arguments);
if(original===null ||
!bestGlobals.isPlainObject(original) &&
!(original instanceof Error) &&
Function registerJson4All
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
bestGlobals.registerJson4All = function registerJson4All(JSON4all){
JSON4all.addType(Date, {
specialTag: function specialTag(value){
if(value.isRealDate){
return 'date';
Function toHms
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.toHms = function toHms(omitSeconds, withDays, omitLeftCeros) {
var leftCero = omitLeftCeros?'':'0';
var tm = this.timeInterval.ms;
var prefix = (tm<0?'-':'');
var tdiff = [];
Function compareForOrder
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
bestGlobals.compareForOrder = function compareForOrder(sortColumns){
var thisModule = this;
return function forOrderComparator(row1,row2){
var column;
var i=0;
Function ymdHmsMm
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
bestGlobals.datetime.ymdHmsMm = function ymdHmsMm(year, month, day, hour, minutes, seconds, ms, micros){
Function ymdHmsM
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
bestGlobals.datetime.ymdHmsM = function ymdHmsM(y, m, d, hh, mm, ss, ms) {
Function ymdHms
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
bestGlobals.datetime.ymdHms = function ymdHms(y, m, d, hh, mm, ss) {
Consider simplifying this complex logical expression. Open
if(match){
var integerParts={};
integerParts.year = parseInt(match[2],10)
integerParts.month = parseInt(match[4],10)
integerParts.day = parseInt(match[7],10)
Consider simplifying this complex logical expression. Open
if(original===null ||
!bestGlobals.isPlainObject(original) &&
!(original instanceof Error) &&
(!opts.mostlyPlain || typeof original != "object" || !bestGlobals.isPlainObject(changes))
// && !bestGlobals.changing
Function isValidTime
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
bestGlobals.Datetime.isValidTime = function isValidTime(h, m, s, ms, micros) {
Function codenautasModuleDefinition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
(function codenautasModuleDefinition(root, name, factory) {
/* global define */
/* istanbul ignore next */
if(typeof root.globalModuleName !== 'string'){
root.globalModuleName = name;
- 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
Avoid too many return
statements within this function. Open
return 0;
Similar blocks of code found in 3 locations. Consider refactoring. Open
var letterTranslator = {
'à':'a', 'á':'a', 'â':'a', 'ã':'a', 'ä':'a', 'å':'a', 'À':'a', 'Á':'a', 'Â':'a', 'Ã':'a', 'Ä':'a', 'Å':'a',
'è':'e', 'é':'e', 'ê':'e', 'ë':'e', 'È':'e', 'É':'e', 'Ê':'e', 'Ë':'e',
'ì':'i', 'í':'i', 'î':'i', 'ï':'i', 'Ì':'i', 'Í':'i', 'Î':'i', 'Ï':'i',
'ò':'o', 'ó':'o', 'ô':'o', 'õ':'o', 'ö':'o', 'Ò':'o', 'Ó':'o', 'Ô':'o', 'Õ':'o', 'Ö':'o',
- 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 248.
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
(function codenautasModuleDefinition(root, name, factory) {
/* global define */
/* istanbul ignore next */
if(typeof root.globalModuleName !== 'string'){
root.globalModuleName = name;
- 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 178.
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
bestGlobals.coalesce.throwError=function throwError(message){
if(this === bestGlobals.coalesce){
return new bestGlobals.coalesce.throwError(message);
}else{
this.message=message;
- 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 68.
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
bestGlobals.coalesce.throwErrorIfUndefined=function throwErrorIfUndefined(message){
if(this === bestGlobals.coalesce){
return new bestGlobals.coalesce.throwErrorIfUndefined(message);
}else{
this.message=message;
- 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 68.
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