seeseemelk/MockBukkit

View on GitHub

Showing 24 of 110 total issues

Method createPotionEffectTypes has 40 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    private void createPotionEffectTypes()
    {
        for (PotionEffectType type : PotionEffectType.values())
        {
            // We probably already registered all Potion Effects
Severity: Minor
Found in src/main/java/be/seeseemelk/mockbukkit/ServerMock.java - About 1 hr to fix

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

        public void performOneTick()
        {
            currentTick++;
            List<ScheduledTask> oldTasks = tasks;
            tasks = new LinkedList<>();

    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 registerDefaultEnchantments has 37 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        public static void registerDefaultEnchantments()
        {
            register("protection");
            register("fire_protection");
            register("feather_falling");

      Method setHealth has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          @Override
          public void setHealth(double health)
          {
              if (health <= 0)
              {
      Severity: Minor
      Found in src/main/java/be/seeseemelk/mockbukkit/entity/LivingEntityMock.java - About 1 hr to fix

        Method performOneTick has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            public void performOneTick()
            {
                currentTick++;
                List<ScheduledTask> oldTasks = tasks;
                tasks = new LinkedList<>();

          Method equals has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean equals(Object obj)
              {
                  if (this == obj)
                      return true;
          Severity: Minor
          Found in src/main/java/be/seeseemelk/mockbukkit/entity/PlayerMock.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 setHealth has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public void setHealth(double health)
              {
                  if (health <= 0)
                  {
          Severity: Minor
          Found in src/main/java/be/seeseemelk/mockbukkit/entity/LivingEntityMock.java - About 45 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 equals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean equals(Object obj)
              {
                  if (this == obj)
                  {

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

              @SuppressWarnings("unchecked")
              @Override
              public boolean setGameRuleValue(String rule, String value)
              {
                  if (rule == null)
          Severity: Minor
          Found in src/main/java/be/seeseemelk/mockbukkit/WorldMock.java - About 45 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 equals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              @Override
              public boolean equals(Object obj)
              {
                  if (this == obj)
                      return true;
          Severity: Minor
          Found in src/main/java/be/seeseemelk/mockbukkit/inventory/meta/BookMetaMock.java - About 45 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 isLoreEquals has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              private boolean isLoreEquals(ItemMeta meta) {
                  if (lore == null)
                      return !meta.hasLore();
                  else if (!meta.hasLore())
                      return false;
          Severity: Minor
          Found in src/main/java/be/seeseemelk/mockbukkit/inventory/meta/ItemMetaMock.java - About 45 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

          Consider simplifying this complex logical expression.
          Open

                      else if (obj != null && obj instanceof BanEntry)
                      {
                          BanEntry banEntry = (BanEntry) obj;
                          return target.equals(banEntry.getTarget()) && expires.equals(banEntry.getExpiration()) && reason.equals(banEntry.getReason())
                                  && source.equals(banEntry.getSource()) && created.equals(banEntry.getCreated()); 
          Severity: Major
          Found in src/main/java/be/seeseemelk/mockbukkit/MockBanList.java - About 40 mins to fix

            Method simulateBlockDamage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public boolean simulateBlockDamage(Block block)
                {
                    if (gamemode == GameMode.SURVIVAL)
                    {
                        BlockDamageEvent event = simulateBlockDamagePure(block);
            Severity: Minor
            Found in src/main/java/be/seeseemelk/mockbukkit/entity/PlayerMock.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

            Method getPlayer has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public Player getPlayer(String name)
                {
                    Player player = getPlayerExact(name);
                    if (player != null)
            Severity: Minor
            Found in src/main/java/be/seeseemelk/mockbukkit/ServerMock.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

            Method isConstructorCompatible has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                private boolean isConstructorCompatible(Constructor<?> constructor, Class<?>[] types)
                {
                    Class<?>[] parameters = constructor.getParameterTypes();
                    for (int i = 0; i < types.length; i++)
                    {
            Severity: Minor
            Found in src/main/java/be/seeseemelk/mockbukkit/plugin/PluginManagerMock.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

            Method addItem has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                public ItemStack addItem(ItemStack item)
                {
                    item = item.clone();
                    for (int i = 0; i < items.length; i++)
                    {
            Severity: Minor
            Found in src/main/java/be/seeseemelk/mockbukkit/inventory/InventoryMock.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

            Method setPage has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                public void setPage(int page, String text)
                {
                    if (!this.isValidPage(page))
                    {
            Severity: Minor
            Found in src/main/java/be/seeseemelk/mockbukkit/inventory/meta/BookMetaMock.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

            Method getPlayers has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                @Override
                @Deprecated
                public Set<OfflinePlayer> getPlayers() throws IllegalStateException {
                    
                    if(!registered)throw new IllegalStateException("Team not registered");
            Severity: Minor
            Found in src/main/java/be/seeseemelk/mockbukkit/scoreboard/TeamMock.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

            Avoid too many return statements within this method.
            Open

                            return false;
            Severity: Major
            Found in src/main/java/be/seeseemelk/mockbukkit/WorldMock.java - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return setGameRule((GameRule<Boolean>) gameRule, value.equalsIgnoreCase("true"));
              Severity: Major
              Found in src/main/java/be/seeseemelk/mockbukkit/WorldMock.java - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language