workcraft/workcraft

View on GitHub
workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java

Summary

Maintainability
C
1 day
Test Coverage

Method createPin has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

    public static VisualContact createPin(VisualCircuit circuit, VisualCircuitComponent component, String name,
            Contact.IOType type, VisualContact.Direction direction, double x, double y) {

    Method createPort has 6 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        public static VisualContact createPort(VisualCircuit circuit, String name,
                Contact.IOType type, VisualContact.Direction direction, double x, double y) {

      Avoid too many return statements within this method.
      Open

                  return ((VisualCircuitComponent) visualNode).getReferencedComponent();

        Avoid too many return statements within this method.
        Open

                return null;

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

              private static Contact findZeroDelayOutput(Contact contact) {
                  Contact zeroDelayOutput = null;
                  Node parent = contact.getParent();
                  if (contact.isInput() && (parent instanceof FunctionComponent)) {
                      FunctionComponent component = (FunctionComponent) parent;
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 136..146

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

          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 static Contact findZeroDelayInput(Contact contact) {
                  Contact zeroDelayInput = null;
                  Node parent = contact.getParent();
                  if (contact.isOutput() && (parent instanceof FunctionComponent)) {
                      FunctionComponent component = (FunctionComponent) parent;
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 246..256

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

          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 static boolean cannotFall(FunctionContact contact) {
                  BooleanFormula resetFunction = contact.getResetFunction();
                  if (resetFunction != null) {
                      return isConstant0(resetFunction);
                  }
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 670..677

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

          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 static boolean cannotRise(FunctionContact contact) {
                  BooleanFormula setFunction = contact.getSetFunction();
                  if (setFunction != null) {
                      return isConstant0(setFunction);
                  }
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 683..690

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

          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 (component.getIsEnvironment()) {
                          // Contact of an environment component
                          if (contact.isInput()) {
                              result = Signal.Type.OUTPUT;
                          } else if (contact.isOutput()) {
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 332..339

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

          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 (contact.isPort()) {
                      // Primary port
                      if (contact.isInput()) {
                          result = Signal.Type.INPUT;
                      } else if (contact.isOutput()) {
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 341..348

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

          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

                  for (Contact mathContact: mathContacts) {
                      VisualContact visualContact = visualCircuit.getVisualComponent(mathContact, VisualContact.class);
                      if (visualContact != null) {
                          result.add(visualContact);
                      }
          workcraft/CircuitPlugin/test-src/org/workcraft/plugins/circuit/JointTransformationCommandTests.java on lines 56..61
          workcraft/StgPlugin/test-src/org/workcraft/plugins/stg/TransformationCommandTests.java on lines 294..299

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

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

              public static Set<String> getInputPortNames(Circuit circuit) {
                  Set<String> result = new HashSet<>();
                  for (Contact port : circuit.getInputPorts()) {
                      result.add(circuit.getName(port));
                  }
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 632..638
          workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/BSONAlg.java on lines 396..404
          workcraft/StgPlugin/src/org/workcraft/plugins/stg/utils/MutexUtils.java on lines 256..262

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

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

              public static Set<String> getOutputPortNames(Circuit circuit) {
                  Set<String> result = new HashSet<>();
                  for (Contact port : circuit.getOutputPorts()) {
                      result.add(circuit.getName(port));
                  }
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 624..630
          workcraft/SonPlugin/src/org/workcraft/plugins/son/algorithm/BSONAlg.java on lines 396..404
          workcraft/StgPlugin/src/org/workcraft/plugins/stg/utils/MutexUtils.java on lines 256..262

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

          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 (curNode instanceof MathConnection) {
                      queue.add(((MathConnection) curNode).getFirst());
                  } else if (curNode != null) {
                      queue.add(curNode);
                  }
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 161..165

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

          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 (curNode instanceof MathConnection) {
                      queue.add(((MathConnection) curNode).getSecond());
                  } else if (curNode != null) {
                      queue.add(curNode);
                  }
          workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/CircuitUtils.java on lines 99..103

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

          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