egordorichev/LastTry

View on GitHub

Showing 120 of 205 total issues

Method spawnBlockDrop has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public Entity spawnBlockDrop(DroppedItem item, int x, int y) {
        Entity entity = spawn(item, x, y);

        // calculate velocity to pop dropped item away from blocks
        Vector2 popVelocity = new Vector2();
Severity: Minor
Found in core/src/org/egordorichev/lasttry/entity/EntityManager.java - About 25 mins to fix

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 copy has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void copy(String from) throws Exception {
        this.copied = true;


        CreatureInfo info = CoreRegistry.get(CreatureManager.class).getCreatureInfo(from);
Severity: Minor
Found in core/src/org/egordorichev/lasttry/entity/CreatureInfo.java - About 25 mins to fix

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 canBeUsed has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public boolean canBeUsed(short x, short y) {
        if (!super.canBeUsed(x, y)) {
            return false;
        }
Severity: Minor
Found in core/src/org/egordorichev/lasttry/item/wall/Wall.java - About 25 mins to fix

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 generateEligibleEnemySpawnPoint has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static Optional<GenericContainer.Pair<Integer>> generateEligibleEnemySpawnPoint(
            CircleAreaComponent enemySpawnArea) {

        GenericContainer.Pair<Integer> minAndMaxDists = retrieveMinMaxDistances(enemySpawnArea);

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 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void update(int dt) {
        super.update(dt);

        if (!this.isActive()) {
Severity: Minor
Found in core/src/org/egordorichev/lasttry/entity/Creature.java - About 25 mins to fix

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 getJavaVMFlags has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private static String getJavaVMFlags() {
        RuntimeMXBean runtimemxbean = ManagementFactory.getRuntimeMXBean();
        List<String> list = runtimemxbean.getInputArguments();
        int i = 0;
        StringBuilder stringbuilder = new StringBuilder();
Severity: Minor
Found in core/src/org/egordorichev/lasttry/core/Crash.java - About 25 mins to fix

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 getAllForMaterial has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static Recipe[] getAllForMaterial(String material) {
        ArrayList<Recipe> recipes = new ArrayList<>();

        for (Recipe recipe : RECIPE_CACHE.values()) {
            for (Recipe.Holder m : recipe.getMaterials()) {
Severity: Minor
Found in core/src/org/egordorichev/lasttry/crafting/RecipeManagerImpl.java - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void update() {
        for (int y = 0; y < SIZE; y++) {
            for (int x = 0; x < SIZE; x++) {
                Block block = (Block) itemManager.getItem(this.data.blocks[x + y * SIZE]);

Severity: Minor
Found in core/src/org/egordorichev/lasttry/world/chunk/Chunk.java - About 25 mins to fix

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 get has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public <T> T get(Class<? extends T> requestedType) {
        Provider<T> provider = providers.get(requestedType);
        if(provider == null) {
            if(parent == null) {
Severity: Minor
Found in core/src/org/egordorichev/lasttry/injection/ContextImpl.java - About 25 mins to fix

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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    public void render() {
        if (this.open) {
            Graphics.batch.draw(this.back, 5, 5);
            super.render();
Severity: Minor
Found in core/src/org/egordorichev/lasttry/ui/chat/UiChat.java - About 25 mins to fix

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 parse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static void parse(String[] args, Object config) throws Exception {
        arguments = args;
        conf = config;

        for (String arg : args) {
Severity: Minor
Found in core/src/org/egordorichev/lasttry/Args.java - About 25 mins to fix

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 onUse has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    protected boolean onUse() {
        int x = LastTry.getMouseXInWorld() / Block.SIZE;
        int y = LastTry.getMouseYInWorld() / Block.SIZE;

Severity: Minor
Found in core/src/org/egordorichev/lasttry/item/items/DigTool.java - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static void save() {
        World world = Globals.getWorld();

        String fileName = Files.getWorldSave(world.getName());
        File file = new File(fileName);
Severity: Minor
Found in core/src/org/egordorichev/lasttry/world/WorldIO.java - About 25 mins to fix

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 getInfectIDFor has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static String getInfectIDFor(String fromID, String id) {
        if (EvilBlock.isCrimsonBlock(fromID)) {
            switch (id) {
                case "lt:stone": return "lt:crimstone";
                case "lt:sand": return "lt:crimsand";
Severity: Minor
Found in core/src/org/egordorichev/lasttry/item/block/EvilBlock.java - About 25 mins to fix

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 setWallHPInside has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void setWallHPInside(byte hp, int x, int y) {
        if (!this.isInside(x, y)) {
            return;
        }
        this.updateLastAccessedTime();
Severity: Minor
Found in core/src/org/egordorichev/lasttry/world/chunk/Chunk.java - About 25 mins to fix

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 inject has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public static  <T> T inject(T object,Context context){
        for (Field field : ReflectionUtils.getAllFields(object.getClass(), ReflectionUtils.withAnnotation(In.class))) {
            Object value = context.get(field.getType());
            if (value != null) {
                try {
Severity: Minor
Found in core/src/org/egordorichev/lasttry/injection/InjectionHelper.java - About 25 mins to fix

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 loadFields has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    @Override
    protected void loadFields(JsonValue root) {
        super.loadFields(root);

        if (root.has("damage")) {
Severity: Minor
Found in core/src/org/egordorichev/lasttry/item/items/Tool.java - About 25 mins to fix

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 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void load() {

        try {
            JsonReader jsonReader = new JsonReader();
            JsonValue root = jsonReader.parse(Gdx.files.internal("data/biomes.json"));
Severity: Minor
Found in core/src/org/egordorichev/lasttry/world/biome/BiomeManagerImpl.java - About 25 mins to fix

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 renderLiquids has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    public void renderLiquids() {
        Rectangle blocksRect = Camera.getBlocksOnScreen();

        for (int y = blocksRect.y; y < blocksRect.y + blocksRect.height; y++) {
            for (int x = blocksRect.x; x < blocksRect.x + blocksRect.width; x++) {

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 updateNeighbors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    private void updateNeighbors(short x, short y) {
        for (short by = (short) (y - 1); by < y + 2; by++) {
            for (short bx = (short) (x - 1); bx < x + 2; bx++) {
                Block block = this.get(bx, by);

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

Severity
Category
Status
Source
Language