Shoobx/shoobx.wfmc

View on GitHub

Showing 39 of 39 total issues

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

class IApplicationDefinition(interface.Interface):
    """Application definition
    """

    __name__ = interface.Attribute("Name")
Severity: Major
Found in src/shoobx/wfmc/interfaces.py and 3 other locations - About 1 hr to fix
src/shoobx/wfmc/interfaces.py on lines 373..381
src/shoobx/wfmc/interfaces.py on lines 384..393
src/shoobx/wfmc/interfaces.py on lines 396..404

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

    def definePools(self, **pools):
        for id, pool in pools.items():
            pool.id = id
            self.pools[id] = pool
Severity: Major
Found in src/shoobx/wfmc/xpdl.py and 3 other locations - About 1 hr to fix
src/shoobx/wfmc/xpdl.py on lines 64..67
src/shoobx/wfmc/xpdl.py on lines 74..77
src/shoobx/wfmc/xpdl.py on lines 91..94

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

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

Function _start has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def _start(self):
        # Return an initial transition

        activities = self.activities

Severity: Minor
Found in src/shoobx/wfmc/process.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    def defineApplications(self, **applications):
        for id, application in applications.items():
            application.id = id
            self.applications[id] = application
Severity: Major
Found in src/shoobx/wfmc/xpdl.py and 3 other locations - About 1 hr to fix
src/shoobx/wfmc/xpdl.py on lines 69..72
src/shoobx/wfmc/xpdl.py on lines 74..77
src/shoobx/wfmc/xpdl.py on lines 91..94

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

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

Function getInitialDataFieldsValues has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

def getInitialDataFieldsValues(datafields, evaluator, strict=True):
    """Form dictionary of initial datafields values."""
    vals = {}
    for _id, datafield in datafields.items():
        val = None
Severity: Minor
Found in src/shoobx/wfmc/process.py - About 1 hr to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    def defineLanes(self, **lanes):
        for id, lane in lanes.items():
            lane.id = id
            self.lanes[id] = lane
Severity: Major
Found in src/shoobx/wfmc/xpdl.py and 3 other locations - About 1 hr to fix
src/shoobx/wfmc/xpdl.py on lines 64..67
src/shoobx/wfmc/xpdl.py on lines 69..72
src/shoobx/wfmc/xpdl.py on lines 74..77

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

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

    def defineParticipants(self, **participants):
        for id, participant in participants.items():
            participant.id = id
            self.participants[id] = participant
Severity: Major
Found in src/shoobx/wfmc/xpdl.py and 3 other locations - About 1 hr to fix
src/shoobx/wfmc/xpdl.py on lines 64..67
src/shoobx/wfmc/xpdl.py on lines 69..72
src/shoobx/wfmc/xpdl.py on lines 91..94

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

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

Function start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def start(self, transition):
        # Start the activity, if we've had enough incoming transitions

        definition = self.definition
        if definition.andJoinSetting:
Severity: Minor
Found in src/shoobx/wfmc/process.py - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def start(self, *arguments):
        if self.isStarted:
            raise TypeError("Already started")

        definition = self.definition
Severity: Minor
Found in src/shoobx/wfmc/process.py - About 55 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

Function __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, from_, to, condition=always_true, id=None,
Severity: Minor
Found in src/shoobx/wfmc/process.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if a.activity_definition_identifier == transition.to:
                                # we already have the activity -- use it
                                next = a
                                break
    
    
    Severity: Major
    Found in src/shoobx/wfmc/process.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if a.process is not activity.process:
                                  continue
                              if a.activity_definition_identifier == transition.to:
      Severity: Major
      Found in src/shoobx/wfmc/process.py - About 45 mins to fix

        Function outputs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def outputs(self):
                outputs = {}
                evaluator = interfaces.IPythonExpressionEvaluator(self)
                for parameter in self.definition.parameters:
                    if parameter.output:
        Severity: Minor
        Found in src/shoobx/wfmc/process.py - About 45 mins to fix

        Cognitive Complexity

        Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

        A method's cognitive complexity is based on a few simple rules:

        • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
        • Code is considered more complex for each "break in the linear flow of the code"
        • Code is considered more complex when "flow breaking structures are nested"

        Further reading

        Function evaluateInputs has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def evaluateInputs(
        Severity: Minor
        Found in src/shoobx/wfmc/process.py - About 35 mins to fix

          Function initSubflow has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def initSubflow(self, subflow_pd_name, starter_activity_id,
          Severity: Minor
          Found in src/shoobx/wfmc/process.py - About 35 mins to fix

            Function digestDeadlineDefinition has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def digestDeadlineDefinition(self, process, definition,
                                             deadlineDef):
                    evaluator = interfaces.IPythonExpressionEvaluator(self.process)
                    if not deadlineDef.duration:
                        log.warning(
            Severity: Minor
            Found in src/shoobx/wfmc/process.py - About 35 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                def deadlineDuration(self, actdef):
                    duration = self.text.strip()
                    actdef.deadlines[-1].duration = duration
            Severity: Minor
            Found in src/shoobx/wfmc/xpdl.py and 1 other location - About 35 mins to fix
            src/shoobx/wfmc/xpdl.py on lines 388..390

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

            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

            Function computeOutgoing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def computeOutgoing(self):
                    if self.explicit_outgoing:
                        transitions = dict([(t.id, t) for t in self.transition_outgoing])
                        self.outgoing = ()
                        for tid in self.explicit_outgoing:
            Severity: Minor
            Found in src/shoobx/wfmc/process.py - About 35 mins to fix

            Cognitive Complexity

            Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

            A method's cognitive complexity is based on a few simple rules:

            • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
            • Code is considered more complex for each "break in the linear flow of the code"
            • Code is considered more complex when "flow breaking structures are nested"

            Further reading

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

                def exceptionName(self, actdef):
                    exceptionName = self.text.strip()
                    actdef.deadlines[-1].exceptionName = exceptionName
            Severity: Minor
            Found in src/shoobx/wfmc/xpdl.py and 1 other location - About 35 mins to fix
            src/shoobx/wfmc/xpdl.py on lines 382..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 33.

            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

            Severity
            Category
            Status
            Source
            Language