workcraft/workcraft

View on GitHub
workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java

Summary

Maintainability
C
1 day
Test Coverage

Consider simplifying this complex logical expression.
Open

        if (isGrouped(first) && isGrouped(second) && !isInSameGroup(first, second)  &&
                (currentConnectonSemantics == Semantics.PNLINE || currentConnectonSemantics == Semantics.ASYNLINE || currentConnectonSemantics == Semantics.SYNCLINE)) {
            throw new InvalidConnectionException("Direct connections between two different groups are not valid (PN Connection, A/Syn Communication)");
        }
Severity: Major
Found in workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java - About 40 mins to fix

    Avoid too many return statements within this method.
    Open

                return result;
    Severity: Major
    Found in workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

                  return result;
      Severity: Major
      Found in workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java - About 30 mins to fix

        Avoid too many return statements within this method.
        Open

                return result;
        Severity: Major
        Found in workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java - About 30 mins to fix

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

              public void setForegroundColor(Node n, Color nodeColor) {
                  if (n instanceof VisualPlaceNode) {
                      ((VisualPlaceNode) n).setForegroundColor(nodeColor);
                  }
                  if (n instanceof VisualTransitionNode) {
          workcraft/SonPlugin/src/org/workcraft/plugins/son/SON.java on lines 165..178

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

          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

                      if (refMan instanceof HierarchyReferenceManager) {
                          HierarchyReferenceManager hierRefMan = (HierarchyReferenceManager) refMan;
                          for (MathNode node: selectedMath) {
                              Container parent = (Container) node.getParent();
                              hierRefMan.setNamespaceProvider(Arrays.asList(node), mathGroup);
          workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java on lines 433..440

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

          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

                      if (refMan instanceof HierarchyReferenceManager) {
                          HierarchyReferenceManager hierRefMan = (HierarchyReferenceManager) refMan;
                          for (Node node: selectedMath) {
                              Container parent = (Container) node.getParent();
                              hierRefMan.setNamespaceProvider(Arrays.asList(node), mathBlock);
          workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java on lines 366..373

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

          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

              private boolean hasInputBhv(VisualNode first) {
                  if (first instanceof VisualCondition) {
                      for (VisualSONConnection con : getVisualConnections((VisualCondition) first)) {
                          if (con.getSemantics() == Semantics.BHVLINE) {
                              if (con.getSecond() == first) {
          workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java on lines 204..215

          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

              private boolean hasOutputBhv(Node second) {
                  if (second instanceof VisualCondition) {
                      for (VisualSONConnection con : getVisualConnections((VisualCondition) second)) {
                          if (con.getSemantics() == Semantics.BHVLINE) {
                              if (con.getFirst() == second) {
          workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java on lines 191..202

          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

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

                      if (group != null) {
                          Point2D centre = TransformHelper.getSnappedCentre(selected);
                          VisualModelTransformer.translateNodes(selected, -centre.getX(), -centre.getY());
                          group.setPosition(centre);
                          select(group);
          workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java on lines 443..448

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

          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

                      if (block != null) {
                          Point2D centre = TransformHelper.getSnappedCentre(selected);
                          VisualModelTransformer.translateNodes(selected, -centre.getX(), -centre.getY());
                          block.setPosition(centre);
                          select(block);
          workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java on lines 376..381

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

          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 (first instanceof VisualChannelPlace) {
                      for (MathNode node : getMathModel().getPreset(((VisualChannelPlace) first).getReferencedComponent())) {
                          if (getMathModel().isInSameGroup(((VisualComponent) second).getReferencedComponent(), node)) {
                              throw new InvalidConnectionException("The input and ouput nodes for a channel place belong to same group are not valid");
                          }
          workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java on lines 146..152

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

          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 (second instanceof VisualChannelPlace) {
                      for (MathNode node : getMathModel().getPostset(((VisualChannelPlace) second).getReferencedComponent())) {
                          if (getMathModel().isInSameGroup(((VisualComponent) first).getReferencedComponent(), node)) {
                              throw new InvalidConnectionException("The input and ouput nodes of a channel place belong to same group are not valid");
                          }
          workcraft/SonPlugin/src/org/workcraft/plugins/son/VisualSON.java on lines 138..144

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

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

                      for (VisualConnection connection : Hierarchy.getChildrenOfType(currentLevel, VisualConnection.class)) {
                          if (Hierarchy.isDescendant(connection.getFirst(), group) &&
                                  Hierarchy.isDescendant(connection.getSecond(), group)) {
                              connectionsToGroup.add(connection);
                          }
          workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/Policy.java on lines 82..86
          workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/VisualPolicy.java on lines 85..89

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

          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

                  if (((first instanceof VisualChannelPlace) && (second instanceof VisualCondition))
                          || ((first instanceof VisualCondition) && (second instanceof VisualChannelPlace))) {
                      throw new InvalidConnectionException("Connections between channel place and condition are not valid (A/Syn Communication)");
                  }
          workcraft/PetriPlugin/src/org/workcraft/plugins/petri/VisualPetri.java on lines 73..76
          workcraft/PetriPlugin/src/org/workcraft/plugins/petri/VisualPetri.java on lines 98..101

          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

          There are no issues that match your filters.

          Category
          Status