Showing 120 of 205 total issues
Method getFirstFreeSlot
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public UiItemSlot getFirstFreeSlot(UiItemSlot.Type type) {
switch (type) {
case ACCESSORY:
return this.getFirstFreeSlot(68, 73);
- 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 loadMod
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
private void loadMod(File file) {
try (JarFile jarFile = new JarFile(file)) {
URL[] urls = new URL[] { new URL("jar:file:" + file.getAbsolutePath() + "!/") };
URLClassLoader urlClassLoader = URLClassLoader.newInstance(urls);
- 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 update
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void update(CreatureWithAI creature, int dt, int currentAi) {
if (currentAi == 0) {
if (creature.physics.getVelocity().y == 0) {
creature.physics.jump();
- 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 run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void run(WorldGenerator generator) {
logger.info("Generating heightmap");
int width = generator.getWorldWidth();
int height = generator.getWorldHeight();
- 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 octavedNoise
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static float octavedNoise(float x, float y, int octaves, float roughness, float scale) {
Method map
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
public static float map(float value, float inMin, float inMax, float outMin, float outMax) {
Method createInstance
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static Item createInstance(JsonValue root, String className) throws Exception {
try {
Class<?> itemClass = Class.forName(className);
Class<?>[] types = {String.class};
- 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 overlay
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
private static void overlay(Pixmap pixmap, Color color) {
ByteBuffer bb = pixmap.getPixels();
final float rTint = color.r;
final float bTint = color.b;
- 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 load
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static void load(String name) {
String fileName = Files.getWorldSave(name);
File file = new File(fileName);
if (!file.exists()) {
- 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 load
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void load() {
File modDirectory = new File(Files.getModsDir());
if (!modDirectory.mkdir()) {
try {
- 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 setupComponents
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void setupComponents() {
super.setupComponents();
this.physics = new PhysicsComponent<DamageParticle>(this) {
@Override
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
@Override
public void update(int dt) {
super.update(dt);
if (this.velocity.y < -1.6) {
- 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 updateLight
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void updateLight(int dt) {
if (!LastTry.noLight) {
if (lightDirty) {
this.light.update(dt);
this.light.clearCache();
- 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 save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static void save(int x, int y) {
String fileName = Files.getChunkSave(x, y);
File file = new File(fileName);
if (!file.exists()) {
try {
- 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 toString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public String toString(boolean use12hoursFormat) {
Byte minuteByte = minute;
String minuteString = minuteByte.toString();
StringBuilder minuteBuilder = new StringBuilder(minuteString);
if(minuteString.length() != 2){
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
protected void update() {
Rectangle rectangle = new Rectangle(this.getX(), this.getClickY(), this.getWidth(), this.getHeight());
int x = (int) InputManager.getMousePosition().x;
int y = (int) InputManager.getMousePosition().y;
- 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 load
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public static Recipe load(JsonValue root) throws Exception {
Recipe recipe = new Recipe();
if (root.has("stations")) {
JsonValue stations = root.get("stations");
- 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 save
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
public void save() {
for (int y = 0; y < Globals.getWorld().getHeight() / Chunk.SIZE; y++) {
for (int x = 0; x < Globals.getWorld().getWidth() / Chunk.SIZE; x++) {
if (this.get(x, y) != null) {
ChunkIO.save(x, y);
- 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 method. Open
return true;
Avoid too many return
statements within this method. Open
return false;