Showing 262 of 262 total issues
Function print
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Logger_console.prototype.print = function (severity, source, msg) {
var arr = msg;
if (typeof this.console === 'undefined' ||
this.console.freedom === true) {
return;
- Create a ticketCreate a ticket
Function fillClients
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
LoopbackSocialProvider.prototype.fillClients = function() {
var STATUSES = ['ONLINE', 'OFFLINE', 'ONLINE_WITH_OTHER_APP'],
userId, nClients, clientId, i;
this.clients = {
"Test User.0": {
- Create a ticketCreate a ticket
Similar blocks of code found in 2 locations. Consider refactoring. Open
while (i--) {
t = stringBuffer[i];
stringBuffer[i + 2] |= 255 & (t << 4);
stringBuffer[i + 1] = t >> 4;
- Read upRead up
- Create a ticketCreate a ticket
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 62.
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
while (i--) {
t = stringBuffer[i];
stringBuffer[i + 3] |= 255 & (t << 4);
stringBuffer[i + 2] = t >> 4;
- Read upRead up
- Create a ticketCreate a ticket
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 62.
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
Consider simplifying this complex logical expression. Open
if (badBuffer[i - 2] === badBuffer[i + 2] &&
badBuffer[i + 2] === badBuffer[i - 1] &&
badBuffer[i - 1] === badBuffer[i + 1] &&
badBuffer[i - 1] * 3 === badBuffer[i] &&
// Background around the foreground pattern? Not part of the specs.
- Create a ticketCreate a ticket
Consider simplifying this complex logical expression. Open
if ((frameBuffer[x + width * y] &&
frameBuffer[(x + 1) + width * y] &&
frameBuffer[x + width * (y + 1)] &&
frameBuffer[(x + 1) + width * (y + 1)]) ||
// All background colour.
- Create a ticketCreate a ticket
Function set
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
IndexedDBStorageProvider.prototype.set = function (key, value, continuation) {
//this.store.set(key, value).then(continuation);
if (this.handle.initializing) {
this.pushQueue("set", key, value, continuation);
return;
- Create a ticketCreate a ticket
Function loadLinks
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
Module.prototype.loadLinks = function () {
var i, channels = ['default'], name, dep;
if (this.manifest.permissions) {
for (i = 0; i < this.manifest.permissions.length; i += 1) {
- Create a ticketCreate a ticket
Function onMessage
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
FileServer.prototype.onMessage = function (val) {
// Try parsing message
try {
val.msgStr = this.social.ab2str(val.data);
val.msg = JSON.parse(val.msgStr);
- Create a ticketCreate a ticket
Function get
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Policy.prototype.get = function(lineage, id) {
// Make sure that a module isn't getting located twice at the same time.
// This is resolved by delaying if it until we see it in a 'moduleAdd' event.
if (this.pending[id]) {
- Create a ticketCreate a ticket
Function _waitSend
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
WebRTCTransportProvider.prototype._waitSend = function(tag, buffers) {
var bufferBound = 0, // upper bound on the # of bytes buffered
sendBuffers, checkBufferedAmount;
sendBuffers = function() {
- Create a ticketCreate a ticket
Function send
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
WebRTCTransportProvider.prototype.send = function(tag, data, continuation) {
// console.log("TransportProvider.send." + this.name);
if(!this._setup) {
continuation(undefined, {
"errcode": "NOTREADY",
- Create a ticketCreate a ticket
Function format
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Debug.prototype.format = function (severity, source, args) {
var i, alist = [], argarr;
if (typeof args === "string" && source) {
try {
argarr = JSON.parse(args);
- Read upRead up
- Create a ticketCreate a ticket
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 register
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Api.prototype.register = function(name, constructor, style, flags) {
var i,
args;
this.providers[name] = {
- Read upRead up
- Create a ticketCreate a ticket
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (this.manager.delegate && this.manager.toDelegate.core) {
this.manager.emit(this.manager.delegate, {
type: 'Delegation',
request: 'handle',
flow: 'core',
- Read upRead up
- Create a ticketCreate a ticket
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
- 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 checkWin
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Board.prototype.checkWin = function () {
'use strict';
var sets = ["012", "345", "678", "036", "147", "258", "048", "246"],
s,
set,
- Read upRead up
- Create a ticketCreate a ticket
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
if (this.isInModule()) {
this.manager.emit(this.manager.delegate, {
type: 'Delegation',
request: 'handle',
flow: 'core',
- Read upRead up
- Create a ticketCreate a ticket
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
- 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 httpResolver
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Resource.prototype.httpResolver = function (manifest, url, resolve, reject) {
var protocols = ["http", "https", "chrome", "chrome-extension", "resource",
"app", "gopher"],
dirname,
protocolIdx,
- Create a ticketCreate a ticket
Function removeLink
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Manager.prototype.removeLink = function (port, name) {
var reverse = this.hub.getDestination(name),
rflow = this.reverseFlowMap[name],
i;
- Create a ticketCreate a ticket
Function onNegotiationNeeded
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
SimpleDataPeer.prototype.onNegotiationNeeded = function (e) {
//console.log(this.peerName + ": " + "onNegotiationNeeded",
// JSON.stringify(this._pc), e);
if (this.pcState !== SimpleDataPeerState.DISCONNECTED) {
// Negotiation messages are falsely requested for new data channels.
- Create a ticketCreate a ticket