workcraft/workcraft

View on GitHub
workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java

Summary

Maintainability
C
1 day
Test Coverage

Avoid deeply nested control flow statements.
Open

                        for (FunctionContact source : net.sources) {
                            if (source.getParent() instanceof FunctionComponent) {
                                FunctionComponent component = (FunctionComponent) source.getParent();
                                reparentAndRenameComponent(circuit, component, signal.name);
                            }

    Method addComponentPin has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        private FunctionContact addComponentPin(Circuit circuit, FunctionComponent component, Signal port,
                Signal signal, HashMap<String, Net> signalToNetMap) {

      Method createLibraryGate has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          private FunctionComponent createLibraryGate(Circuit circuit, VerilogInstance verilogInstance,
                  HashMap<String, Net> signalToNetMap, Gate gate, SubstitutionRule substitutionRule) {

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

                if (!uninitialisedSignals.isEmpty()) {
                    String itemText = '\n' + PropertyHelper.BULLET_PREFIX + TextUtils.wrapMessageWithItems(
                            "Missing initial state declaration (assuming low) for signal",
                            SortUtils.getSortedNatural(uninitialisedSignals));
        
        
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 389..395
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 398..404
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 104..110
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 113..119
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 125..131
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 134..140

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

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

                if (!unusedSignals.isEmpty()) {
                    String itemText = '\n' + PropertyHelper.BULLET_PREFIX + TextUtils.wrapMessageWithItems(
                            "Initial state declaration for unused signal", SortUtils.getSortedNatural(unusedSignals));
        
                    longMessage += itemText;
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 377..384
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 398..404
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 104..110
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 113..119
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 125..131
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 134..140

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

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

                if (!ignoredSignals.isEmpty()) {
                    String itemText = '\n' + PropertyHelper.BULLET_PREFIX + TextUtils.wrapMessageWithItems(
                            "Ignored inout port", SortUtils.getSortedNatural(ignoredSignals));
        
                    longMessage += itemText;
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 377..384
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 389..395
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 104..110
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 113..119
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 125..131
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/utils/VerificationUtils.java on lines 134..140

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

        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 (netStates != null) {
                    for (Map.Entry<VerilogNet, Boolean> entry : netStates.entrySet()) {
                        VerilogNet verilogNet = entry.getKey();
                        Boolean state = entry.getValue();
                        String netName = VerilogUtils.getNetBusSuffixName(verilogNet);
        workcraft/WorkcraftCore/test-src/org/workcraft/dom/hierarchy/HierarchicalUniqueNameReferenceManagerTest.java on lines 55..63

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

        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 < second) {
                        for (int i = first; i <= second; i++) {
                            VerilogNet verilogNet = new VerilogNet(verilogPort.name, i);
                            result.add(VerilogUtils.getNetBusSuffixName(verilogNet));
                        }
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 752..757

        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

                    } else {
                        for (int i = first; i >= second; i--) {
                            VerilogNet verilogNet = new VerilogNet(verilogPort.name, i);
                            result.add(VerilogUtils.getNetBusSuffixName(verilogNet));
                        }
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 747..752

        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

                    String sinksString = net.sinks.isEmpty() ? "" : ('\n' + PropertyHelper.BULLET_PREFIX + "sinks: "
                            + String.join(", ", ReferenceHelper.getReferenceSet(circuit, net.sinks)));
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 1227..1228

        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

                    String undefinedString = net.undefined.isEmpty() ? "" : ('\n' + PropertyHelper.BULLET_PREFIX + "undefined: "
                            + String.join(", ", ReferenceHelper.getReferenceSet(circuit, net.undefined)));
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 1224..1225

        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

                        if (!sinkContact.isPort() && sinkContact.isOutput()) {
                            sinkContact.setIOType(IOType.INPUT);
                            LogUtils.logWarning(prefix + "sink contact '" + sinkRef + "' is changed to input pin");
                        }
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 1254..1257

        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 (!sourceContact.isPort() && sourceContact.isInput()) {
                        sourceContact.setIOType(IOType.OUTPUT);
                        LogUtils.logWarning(prefix + "source contact '" + sourceRef + "' is changed to output pin");
                    }
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 1264..1267

        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 (sourceContact.isPort() && sourceContact.isOutput()) {
                        sourceContact.setIOType(IOType.INPUT);
                        LogUtils.logWarning(prefix + "source contact '" + sourceRef + "' is changed to input port");
                    }
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 1260..1263

        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 (sinkContact.isPort() && sinkContact.isInput()) {
                            sinkContact.setIOType(IOType.OUTPUT);
                            LogUtils.logWarning(prefix + "sink contact '" + sinkRef + "' is changed to output port");
                        }
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 1250..1253

        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

                for (Net net : signalToNetMap.values()) {
                    if (net != null) {
                        for (Contact source : net.sources) {
                            source.setInitToOne(true);
                        }
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 1300..1306

        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

                for (Net net : signalToNetMap.values()) {
                    if (net != null) {
                        for (Contact source : net.sources) {
                            source.setInitToOne(false);
                        }
        workcraft/CircuitPlugin/src/org/workcraft/plugins/circuit/interop/AbstractVerilogImporter.java on lines 1293..1299

        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

        There are no issues that match your filters.

        Category
        Status