oglimmer/ggo

View on GitHub

Showing 183 of 183 total issues

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

    @Override
    public Collection<UIButton> getButtons(Player forPlayer) {
        Collection<UIButton> buttons = new ArrayList<>();
        buttons.add(UIButton.builder().id("doneButton").text("Done").width(30).height(20)
                .hidden(!inTurn.contains(forPlayer)).build());
core/src/main/java/de/oglimmer/ggo/logic/phase/CombatDisplayPhase.java on lines 113..119

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 54.

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 Collection<UIButton> getButtons(Player forPlayer) {
        Collection<UIButton> buttons = new ArrayList<>();
        buttons.add(UIButton.builder().id("doneButton").text("Done").width(30).height(20)
                .hidden(!inTurn.contains(forPlayer)).build());
core/src/main/java/de/oglimmer/ggo/logic/phase/CombatCommandPhase.java on lines 217..223

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 54.

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 3 locations. Consider refactoring.
Open

                .newPhase(CodeExecBuilder.class).exec(() -> {
                    Player opponent = game.getPlayers().get(1);
                    game.getCurrentPhase().execCmd(opponent, "selectHandCard", opponent.getUnitInHand().get(0).getId());
                    game.getCurrentPhase().execCmd(opponent, "selectTargetField", "5:3");
                }).end()
core/src/main/java/de/oglimmer/ggo/logic/phase/tutorial/TutorialStepFactory.java on lines 86..90
core/src/main/java/de/oglimmer/ggo/logic/phase/tutorial/TutorialStepFactory.java on lines 107..111

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 54.

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

            ctx.fillText(this.text,x+0.033*Constants.size.width,y+.2*Constants.size.height);
Severity: Minor
Found in web/src/main/webapp/js/app/Button.js and 1 other location - About 40 mins to fix
web/src/main/webapp/js/app/Button.js on lines 49..49

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 49.

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

            ctx.fillText(this.text,x+.5*Constants.size.width,y+.767*Constants.size.height);
Severity: Minor
Found in web/src/main/webapp/js/app/Button.js and 1 other location - About 40 mins to fix
web/src/main/webapp/js/app/Button.js on lines 52..52

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 49.

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

Consider simplifying this complex logical expression.
Open

                                if (!cdoc.body || !cdoc.body.firstChild || cdoc.body.firstChild.nodeName.toLowerCase() !== "pre") {
                                    // Injects a plaintext element which renders text without interpreting the HTML and cannot be stopped
                                    // it is deprecated in HTML5, but still works
                                    var head = cdoc.head || cdoc.getElementsByTagName("head")[0] || cdoc.documentElement || cdoc;
                                    var script = cdoc.createElement("script");
Severity: Major
Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js - About 40 mins to fix

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

        public AtmosphereResourceCacheItem getAtmosphereResources(Player p) {
            Optional<AtmosphereResourceCacheItem> item = atmosphereResources.stream().filter(ar -> ar.getPlayer() == p)
                    .findFirst();
            if (item.isPresent()) {
                return item.get();
    atmosphere-mvc/src/main/java/de/oglimmer/atmospheremvc/com/AtmosphereResourceCache.java on lines 129..136

    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 48.

    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 AtmosphereResourceCacheItem getItem(Player player) {
            Optional<AtmosphereResourceCacheItem> findFirst = items.stream().filter(i -> i.getPlayer() == player)
                    .findFirst();
            if (findFirst.isPresent()) {
                return findFirst.get();
    web/src/main/java/de/oglimmer/ggo/web/action/DebugActionBean.java on lines 77..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 48.

    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

    Function addPendingChange has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        var addPendingChange = function(obj,prop, mode, newval, oldval) {
    Severity: Minor
    Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

      Function watchOne has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          var watchOne = function (obj, prop, watcher, level, addNRemove) {
      Severity: Minor
      Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

        Function trackProperty has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            var trackProperty = function(obj,prop,callback,recursive, addNRemove) { 
        Severity: Minor
        Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

          Function watchMany has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              var watchMany = function (obj, props, watcher, level, addNRemove) {
          Severity: Minor
          Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

            Function callWatchers has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                var callWatchers = function (obj, prop, action, newval, oldval) {
            Severity: Minor
            Found in web/src/main/webapp/js/lib/watch-1.3.0.js - About 35 mins to fix

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

                      if (atmosphere.util.browser.msie || (atmosphere.util.browser.mozilla && +atmosphere.util.browser.version.split(".")[0] === 1)) {
              Severity: Minor
              Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js and 1 other location - About 35 mins to fix
              web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js on lines 1870..1870

              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 47.

              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

                              if (atmosphere.util.browser.msie && +atmosphere.util.browser.version.split(".")[0] < 10) {
              Severity: Minor
              Found in web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js and 1 other location - About 35 mins to fix
              web/src/main/webapp/js/lib/atmosphere-javascript-2.3.2.js on lines 3421..3421

              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 47.

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

                  @Override
                  public void deploy() {
                      Unit toDeploy = player.getUnitInHand().get(0);
                      DeployPhase dp = (DeployPhase) game.getCurrentPhase();
                      Field toDeployField = null;
              Severity: Minor
              Found in core/src/main/java/de/oglimmer/ggo/logic/ai/RandomStrategy.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 diffEntry has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
              Open

                  private void diffEntry(ObjectNode diffNode, String key, JsonNode oldValue, JsonNode newValue) {
                      if (newValue != null && newValue.isArray()) {
                          diffArray(diffNode, key, oldValue, newValue);
                      } else if (newValue != null && newValue.isObject()) {
                          diffObject(diffNode, key, oldValue, newValue);
              Severity: Minor
              Found in atmosphere-mvc/src/main/java/de/oglimmer/atmospheremvc/util/Json.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

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

                  public Field getField(Point pos) {
                      Optional<Field> opt = fields.stream().filter(f -> f.getPos().equals(pos)).findFirst();
                      return opt.isPresent() ? opt.get() : null;
                  }
              Severity: Minor
              Found in core/src/main/java/de/oglimmer/ggo/logic/Board.java and 1 other location - About 35 mins to fix
              core/src/main/java/de/oglimmer/ggo/logic/Board.java on lines 49..52

              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 44.

              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

                          this.send(p.getEmail(), "[GridGameOne] Game invite",
                                  "Hi,\n\nyou have been invited to a game of GridGameOne.\n\n"
                                          + "Click here to do your first turn:\nhttp://" + PROPERTIES.getDomain()
                                          + PROPERTIES.getUrlPath() + "/Board.action?playerId=" + p.getId() + "\n\n\nRegards,\nOliZ");
              Severity: Minor
              Found in core/src/main/java/de/oglimmer/ggo/email/EmailService.java and 1 other location - About 35 mins to fix
              core/src/main/java/de/oglimmer/ggo/email/EmailService.java on lines 57..60

              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 44.

              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 Field getField(String id) {
                      Optional<Field> opt = fields.stream().filter(f -> f.getId().equals(id)).findFirst();
                      return opt.isPresent() ? opt.get() : null;
                  }
              Severity: Minor
              Found in core/src/main/java/de/oglimmer/ggo/logic/Board.java and 1 other location - About 35 mins to fix
              core/src/main/java/de/oglimmer/ggo/logic/Board.java on lines 54..57

              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 44.

              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

              Severity
              Category
              Status
              Source
              Language