roobre/chestorganizer

View on GitHub

Showing 3 of 51 total issues

Method findSuitable has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    private Container findSuitable(Location chestLocation, Material material) {
        Container bestCandidate = null;
        double bestDistance = Double.POSITIVE_INFINITY;

        for (int deltaX = -RANGE_HORIZONTAL; deltaX <= RANGE_HORIZONTAL; deltaX++) {
Severity: Minor
Found in src/main/java/es/roobre/chestorganizer/ChestOrganizer.java - About 1 hr 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 onInventoryClick has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    @EventHandler
    public void onInventoryClick(InventoryClickEvent click) {
        // Get currently open inventory
        InventoryHolder holder = click.getInventory().getHolder();
        if (!(isOrganizer(holder))) {
Severity: Minor
Found in src/main/java/es/roobre/chestorganizer/ChestOrganizer.java - About 55 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 7 (exceeds 5 allowed). Consider refactoring.
Open

    synchronized Location get(Location organizerLocation, Material material) {
        Map<Material, CacheEntry<Location>> materialMap = this.holder.get(organizerLocation);
        if (materialMap != null) {
            CacheEntry<Location> entry = materialMap.get(material);
            if (entry != null && entry.time + MAX_AGE > System.currentTimeMillis()) {
Severity: Minor
Found in src/main/java/es/roobre/chestorganizer/Cache.java - About 35 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

Severity
Category
Status
Source
Language