seeseemelk/MockBukkit

View on GitHub

Showing 105 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");

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          @Override
          public boolean addCustomEffect(@NotNull PotionEffect effect, boolean overwrite) {
              int index = indexOf(effect.getType());
      
              if (index == -1) {
      src/main/java/be/seeseemelk/mockbukkit/inventory/meta/PotionMetaMock.java on lines 90..114

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 97.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Identical blocks of code found in 2 locations. Consider refactoring.
      Open

          @Override
          public boolean addCustomEffect(@NotNull PotionEffect effect, boolean overwrite)
          {
              int index = indexOf(effect.getType());
      
      
      src/main/java/be/seeseemelk/mockbukkit/inventory/meta/SuspiciousStewMetaMock.java on lines 64..84

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 97.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      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

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

              @Override
              public boolean equals(Object obj)
              {
                  if (this == obj)
                  {
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/EnchantedBookMetaMock.java on lines 40..53
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/FireworkMetaMock.java on lines 39..57
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/SuspiciousStewMetaMock.java on lines 41..55

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 70.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              @Override
              public boolean removeCustomEffect(@NotNull PotionEffectType type) {
                  Iterator<PotionEffect> iterator = effects.iterator();
                  boolean changed = false;
          
          
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/PotionMetaMock.java on lines 142..160

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 70.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              @Override
              public boolean removeCustomEffect(@NotNull PotionEffectType type)
              {
                  Iterator<PotionEffect> iterator = effects.iterator();
                  boolean changed = false;
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/SuspiciousStewMetaMock.java on lines 108..123

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 70.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

              @Override
              public boolean equals(Object obj)
              {
                  if (this == obj)
                  {
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/EnchantedBookMetaMock.java on lines 40..53
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/KnowledgeBookMetaMock.java on lines 44..62
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/SuspiciousStewMetaMock.java on lines 41..55

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 70.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

              @Override
              public boolean equals(Object obj) {
                  if (this == obj) {
                      return true;
                  }
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/FireworkMetaMock.java on lines 39..57
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/KnowledgeBookMetaMock.java on lines 44..62
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/SuspiciousStewMetaMock.java on lines 41..55

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 70.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 4 locations. Consider refactoring.
          Open

              @Override
              public boolean equals(Object obj) {
                  if (this == obj) {
                      return true;
                  }
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/EnchantedBookMetaMock.java on lines 40..53
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/FireworkMetaMock.java on lines 39..57
          src/main/java/be/seeseemelk/mockbukkit/inventory/meta/KnowledgeBookMetaMock.java on lines 44..62

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 70.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              public ScheduledTask(int id, Plugin plugin, boolean isSync, long scheduledTick, Runnable runnable)
              {
                  this.id = id;
                  this.plugin = plugin;
                  this.isSync = isSync;
          src/main/java/be/seeseemelk/mockbukkit/entity/AudioExperience.java on lines 22..29

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

              AudioExperience(Sound sound, SoundCategory category, Location l, float volume, float pitch)
              {
                  this.sound = sound;
                  this.category = category;
                  this.location = l;
          src/main/java/be/seeseemelk/mockbukkit/scheduler/ScheduledTask.java on lines 17..24

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 60.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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

          Severity
          Category
          Status
          Source
          Language