workcraft/workcraft

View on GitHub
workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java

Summary

Maintainability
C
1 day
Test Coverage

Avoid deeply nested control flow statements.
Open

                        for (VisualConnection newConnection : productConnectionMap.keySet()) {
                            if (newConnection.getFirst() == productPlace) {
                                ConnectionHelper.prependControlPoints(newConnection, succLocations);
                            }
                            filterControlPoints(newConnection);

    Avoid deeply nested control flow statements.
    Open

                            for (VisualConnection newConnection : productConnectionMap.keySet()) {
                                if (newConnection.getSecond() == productPlace) {
                                    ConnectionHelper.addControlPoints(newConnection, predLocations);
                                }
                                filterControlPoints(newConnection);

      Avoid too many return statements within this method.
      Open

              return true;

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

            public VisualPlace createProductPlace(VisualModel visualModel, VisualPlace predPlace, VisualPlace succPlace) {
                Container visualContainer = (Container) Hierarchy.getCommonParent(predPlace, succPlace);
                Container mathContainer = NamespaceHelper.getMathContainer(visualModel, visualContainer);
                MathModel mathModel = visualModel.getMathModel();
                HierarchyReferenceManager refManager = (HierarchyReferenceManager) mathModel.getReferenceManager();
        workcraft/StgPlugin/src/org/workcraft/plugins/stg/commands/ContractNamedTransitionTransformationCommand.java on lines 87..99

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

        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

                for (MathNode succNode : succNodes) {
                    Place succPlace = (Place) succNode;
                    if (succPlace.getTokens() != 0) {
                        return false;
                    }
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 212..222

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

        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

                for (MathNode succNode : succNodes) {
                    Place succPlace = (Place) succNode;
                    if (succPlace.getTokens() != 0) {
                        return false;
                    }
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 236..246

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

        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 (model.getPreset(predPlace).size() < 2) {
                                for (VisualConnection newConnection : productConnectionMap.keySet()) {
                                    if (newConnection.getSecond() == productPlace) {
                                        ConnectionHelper.addControlPoints(newConnection, predLocations);
                                    }
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 299..306

        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 (model.getPostset(succPlace).size() < 2) {
                                for (VisualConnection newConnection : productConnectionMap.keySet()) {
                                    if (newConnection.getFirst() == productPlace) {
                                        ConnectionHelper.prependControlPoints(newConnection, succLocations);
                                    }
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 307..314

        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 (productConnection.getFirst() instanceof VisualTransition) {
                            VisualTransition transition = (VisualTransition) productConnection.getFirst();
                            predPlaceConnection = visualModel.getConnection(transition, predPlace);
                            succPlaceConnection = visualModel.getConnection(transition, succPlace);
                        }
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 436..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 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 2 locations. Consider refactoring.
        Open

                        if (productConnection.getSecond() instanceof VisualTransition) {
                            VisualTransition transition = (VisualTransition) productConnection.getSecond();
                            predPlaceConnection = visualModel.getConnection(predPlace, transition);
                            succPlaceConnection = visualModel.getConnection(succPlace, transition);
                        }
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 431..435

        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

                for (MathNode predNode : predNodes) {
                    HashSet<MathNode> predSuccNodes = new HashSet<>(model.getPostset(predNode));
                    predSuccNodes.remove(transition);
                    if (!predSuccNodes.isEmpty()) {
                        return false;
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 190..196
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.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 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 3 locations. Consider refactoring.
        Open

                for (MathNode succNode : succNodes) {
                    HashSet<MathNode> succPredNodes = new HashSet<>(model.getPreset(succNode));
                    succPredNodes.remove(transition);
                    if (!succPredNodes.isEmpty()) {
                        return false;
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 167..173
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.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 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 3 locations. Consider refactoring.
        Open

                for (MathNode predNode : predNodes) {
                    HashSet<MathNode> predSuccNodes = new HashSet<>(model.getPostset(predNode));
                    predSuccNodes.remove(transition);
                    if (!predSuccNodes.isEmpty()) {
                        return false;
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 167..173
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 190..196

        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

                        if (originalConnection instanceof VisualReadArc) {
                            if (first instanceof VisualTransition) {
                                newConnection = visualModel.connectUndirected(first, productPlace);
                            }
                            if (second instanceof VisualTransition) {
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 377..384

        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

                        } else {
                            if (first instanceof VisualTransition) {
                                newConnection = visualModel.connect(first, productPlace);
                            }
                            if (second instanceof VisualTransition) {
        workcraft/PetriPlugin/src/org/workcraft/plugins/petri/commands/ContractTransitionTransformationCommand.java on lines 370..377

        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

        There are no issues that match your filters.

        Category
        Status