Showing 102 of 183 total issues
Function listener
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function listener(string) {
var command = atmosphere.util.parseJSON(string), data = command.data;
if (command.target === "c") {
switch (command.type) {
Function WebsocketApiAdapter
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
WebsocketApiAdapter: function (request) {
var _socket, _adapter;
/**
* Overrides the onMessage callback in given request.
Function _disconnect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
function _disconnect() {
if (_request.enableProtocol && !_request.disableDisconnect && !_request.firstMessage) {
var query = "X-Atmosphere-Transport=close&X-Atmosphere-tracking-id=" + _request.uuid;
atmosphere.util.each(_request.headers, function (name, value) {
Method show
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
@DefaultHandler
@DontValidate
public Resolution show() {
if (getContext().getRequest().getCookies() != null) {
for (Cookie cookie : getContext().getRequest().getCookies()) {
- 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
Method getPossibleCommandTypes
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
public Set<CommandType> getPossibleCommandTypes(CommandCenter cc, Field targetField) {
Set<CommandType> possibleCommands = new HashSet<>();
if (getMovableFields(cc).contains(targetField)) {
possibleCommands.add(CommandType.MOVE);
}
- 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 param
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
param: function (params) {
var prefix, s = [];
function add(key, value) {
value = atmosphere.util.isFunction(value) ? value() : (value == null ? "" : value);
Method getPossibleCommandTypes
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
public Set<CommandType> getPossibleCommandTypes(CommandCenter cc, Field targetField) {
Set<CommandType> possibleCommands = new HashSet<>();
if (getMovableFields(cc).contains(targetField)) {
possibleCommands.add(CommandType.MOVE);
}
Function windowref
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
windowref: function () {
var win = window.open("", name.replace(/\W/g, ""));
if (!win || win.closed || !win.callbacks) {
return;
Function watchAll
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
var watchAll = function (obj, watcher, level, addNRemove) {
if ((typeof obj == "string") || (!(obj instanceof Object) && !isArray(obj))) { //accepts only objects and array (not string)
return;
}
Method existsOrChanged
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
private JsonNode existsOrChanged(JsonNode nodeToFind, ArrayNode arrayToSearchThrough) {
if (nodeToFind.isObject()) {
for (Iterator<JsonNode> it = arrayToSearchThrough.elements(); it.hasNext();) {
JsonNode elementInArray = it.next();
assert elementInArray.isObject();
- 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 drawArrow
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function drawArrow(ctx, fromx, fromy, tox, toy, color, onlyHeads){
Avoid deeply nested control flow statements. Open
if (data.heir === guid) {
_execute();
} else {
setTimeout(function () {
_execute();
Avoid deeply nested control flow statements. Open
if (skipCallbackInvocation) {
return;
}
Avoid deeply nested control flow statements. Open
if(a[j] === undefined) {
bplus.push(j);
}
Avoid deeply nested control flow statements. Open
if (action!=='splice') {
watchAll(newValue, watchList[i], (level===undefined)?level:level-1);
}
else {
// watch spliced values
Avoid deeply nested control flow statements. Open
if (!_response.ffTryingReconnect) {
_triggerOpen(rq);
}
Avoid deeply nested control flow statements. Open
if (_response.status !== 500 && ajaxRequest.responseText.length > rq.lastIndex) {
try {
_response.status = ajaxRequest.status;
_response.headers = atmosphere.util.parseHeaders(ajaxRequest.getAllResponseHeaders());
Method setCurrentPhase
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
public boolean setCurrentPhase(BasePhase nextPhase) {
if (currentPhase instanceof TutorialDelegateBasePhase) {
// currentPhase is a delegable
TutorialDelegateBasePhase currentPhaseTutorial = (TutorialDelegateBasePhase) currentPhase;
if (nextPhase instanceof TutorialDelegateBasePhase) {
- 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 deeply nested control flow statements. Open
if (v) {
partial.push(quote(i) + ":" + v);
}
Avoid deeply nested control flow statements. Open
if(b[i] === undefined) {
aplus.push(i);
}