Showing 102 of 183 total issues
Avoid deeply nested control flow statements. Open
if (skipCallbackInvocation) {
return;
}
Consider simplifying this complex logical expression. Open
if (!cdoc.body || !cdoc.body.firstChild || cdoc.body.firstChild.nodeName.toLowerCase() !== "pre") {
// Injects a plaintext element which renders text without interpreting the HTML and cannot be stopped
// it is deprecated in HTML5, but still works
var head = cdoc.head || cdoc.getElementsByTagName("head")[0] || cdoc.documentElement || cdoc;
var script = cdoc.createElement("script");
Function watchOne
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var watchOne = function (obj, prop, watcher, level, addNRemove) {
Function callWatchers
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var callWatchers = function (obj, prop, action, newval, oldval) {
Function watchMany
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var watchMany = function (obj, props, watcher, level, addNRemove) {
Function trackProperty
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var trackProperty = function(obj,prop,callback,recursive, addNRemove) {
Function addPendingChange
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
var addPendingChange = function(obj,prop, mode, newval, oldval) {
Method deploy
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void deploy() {
Unit toDeploy = player.getUnitInHand().get(0);
DeployPhase dp = (DeployPhase) game.getCurrentPhase();
Field toDeployField = null;
- 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 diffEntry
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private void diffEntry(ObjectNode diffNode, String key, JsonNode oldValue, JsonNode newValue) {
if (newValue != null && newValue.isArray()) {
diffArray(diffNode, key, oldValue, newValue);
} else if (newValue != null && newValue.isObject()) {
diffObject(diffNode, key, oldValue, newValue);
- 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;
Avoid too many return
statements within this function. Open
return false;
Avoid too many return
statements within this function. Open
return val;
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 method. Open
return Math.random() < 0.5 ? player1 : player2;
Method switchPlayer
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected void switchPlayer(Player player) {
boolean nextPhase = false;
activePlayer.getMessages().clearErrorInfo();
Player nextPlayer = getGame().getOtherPlayer(activePlayer);
if (!hasMoreMoves(nextPlayer)) {
- 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 score
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
protected static void score(Unit winningUnit, CommandCenter cc) {
CommandType ct = cc.getByUnit(winningUnit).getCommandType();
if (!cc.isDry()) {
int score = 0;
if (ct == 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
Method nextPhase
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
@Override
protected void nextPhase() {
cc.calcBattle();
combatPhaseRoundCounter.incRound();
if (combatPhaseRoundCounter.lastRoundReached() || getGame().getBoard().getTotalUnits() == 0) {
- 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 diffPrimitive
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
private void diffPrimitive(ObjectNode diffNode, String key, JsonNode oldValue, JsonNode newValue) {
assert newValue == null || !newValue.isContainerNode();
assert oldValue == null || !oldValue.isContainerNode();
if ((newValue == null && oldValue != null) || (newValue != null && !newValue.equals(oldValue))) {
diffNode.set(key, newValue);
- 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"