workcraft/workcraft

View on GitHub
workcraft/StgPlugin/src/org/workcraft/plugins/stg/VisualStg.java

Summary

Maintainability
C
1 day
Test Coverage

Consider simplifying this complex logical expression.
Open

        if (((first instanceof VisualStgPlace) || (first instanceof VisualReplicaPlace) || (first instanceof VisualImplicitPlaceArc))
                && ((second instanceof VisualStgPlace) || (second instanceof VisualReplicaPlace) || (second instanceof VisualImplicitPlaceArc))) {
            throw new InvalidConnectionException("Arcs between places are not allowed.");
        }
Severity: Major
Found in workcraft/StgPlugin/src/org/workcraft/plugins/stg/VisualStg.java - About 40 mins to fix

    Consider simplifying this complex logical expression.
    Open

            if (ConnectionUtils.hasReadArcConnection(this, first, second)
                    || ConnectionUtils.hasReadArcConnection(this, second, first)
                    || ConnectionUtils.hasProducingArcConnection(this, first, second)
                    || ConnectionUtils.hasProducingArcConnection(this, second, first)
                    || ConnectionUtils.hasConsumingArcConnection(this, first, second)
    Severity: Major
    Found in workcraft/StgPlugin/src/org/workcraft/plugins/stg/VisualStg.java - About 40 mins to fix

      Consider simplifying this complex logical expression.
      Open

              if (((first instanceof VisualStgPlace) || (first instanceof VisualReplicaPlace) || (first instanceof VisualImplicitPlaceArc))
                      && ((second instanceof VisualStgPlace) || (second instanceof VisualReplicaPlace) || (second instanceof VisualImplicitPlaceArc))) {
                  throw new InvalidConnectionException("Arcs between places are not allowed.");
              }
      Severity: Major
      Found in workcraft/StgPlugin/src/org/workcraft/plugins/stg/VisualStg.java - About 40 mins to fix

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

                if (ConnectionUtils.hasReadArcConnection(this, first, second)
                        || ConnectionUtils.hasReadArcConnection(this, second, first)
                        || ConnectionUtils.hasProducingArcConnection(this, first, second)
                        || ConnectionUtils.hasProducingArcConnection(this, second, first)
                        || ConnectionUtils.hasConsumingArcConnection(this, first, second)
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/VisualPetri.java on lines 105..112

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

        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 VisualDummyTransition createVisualDummyTransition(String mathName, Container container) {
                if (NamespaceHelper.isHierarchical(mathName)) {
                    throw new RuntimeException("Cannot create a dummy with the hierarchical name '" + mathName + "'.");
                }
                Container mathContainer = NamespaceHelper.getMathContainer(this, container);
        workcraft/StgPlugin/src/org/workcraft/plugins/stg/VisualStg.java on lines 289..296

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

        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 VisualStgPlace createVisualPlace(String mathName, Container container) {
                if (NamespaceHelper.isHierarchical(mathName)) {
                    throw new RuntimeException("Cannot create a place with the hierarchical name '" + mathName + "'.");
                }
                Container mathContainer = NamespaceHelper.getMathContainer(this, container);
        workcraft/StgPlugin/src/org/workcraft/plugins/stg/VisualStg.java on lines 302..309

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

        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 (((first instanceof VisualStgPlace) || (first instanceof VisualReplicaPlace) || (first instanceof VisualImplicitPlaceArc))
                        && ((second instanceof VisualStgPlace) || (second instanceof VisualReplicaPlace) || (second instanceof VisualImplicitPlaceArc))) {
                    throw new InvalidConnectionException("Arcs between places are not allowed.");
                }
        workcraft/StgPlugin/src/org/workcraft/plugins/stg/VisualStg.java on lines 80..83

        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 (((first instanceof VisualStgPlace) || (first instanceof VisualReplicaPlace) || (first instanceof VisualImplicitPlaceArc))
                        && ((second instanceof VisualStgPlace) || (second instanceof VisualReplicaPlace) || (second instanceof VisualImplicitPlaceArc))) {
                    throw new InvalidConnectionException("Arcs between places are not allowed.");
                }
        workcraft/StgPlugin/src/org/workcraft/plugins/stg/VisualStg.java on lines 160..163

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

                if (placeOrReplica instanceof VisualStgPlace) {
                    mPlace = ((VisualStgPlace) placeOrReplica).getReferencedComponent();
                } else if (placeOrReplica instanceof VisualReplicaPlace) {
                    mPlace = ((VisualReplicaPlace) placeOrReplica).getReferencedPlace();
                }
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/tools/InitialisationAnalyserTool.java on lines 263..267
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/VisualPetri.java on lines 135..139
        workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/VisualLocality.java on lines 22..26
        workcraft/PolicyPlugin/src/org/workcraft/plugins/policy/VisualLocality.java on lines 58..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 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

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

                if (mConnection == null) {
                    MathNode firstRef = getReferencedComponent(first);
                    MathNode secondRef = getReferencedComponent(second);
                    mConnection = getMathModel().connect(firstRef, secondRef);
                }
        workcraft/XmasPlugin/src/org/workcraft/plugins/xmas/VisualXmas.java on lines 63..67

        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

                    if (second instanceof VisualNamedTransition) {
                        VisualImplicitPlaceArc con = (VisualImplicitPlaceArc) first;
                        VisualStgPlace place = makeExplicit(con);
                        connection = connect(place, second);
                    }
        workcraft/WorkcraftCore/src/org/workcraft/dom/visual/SelectionHelper.java on lines 47..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 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