cocaine/cocaine-framework-python

View on GitHub

Showing 25 of 45 total issues

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

    def update_verbosity(self):
        counter = next(self.counter)
        verbosity_request = msgpack_packb([counter, VERBOSITY, []])
        self.pipe.write(verbosity_request)
        buff = msgpack_unpacker()
Severity: Minor
Found in cocaine/detail/logger.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

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

    def connect(self, traceid=None):
        if self._connected:
            return

        log = get_trace_adapter(self.log, traceid)
Severity: Minor
Found in cocaine/detail/baseservice.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

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

    def connect(self, traceid=None):
        log = get_trace_adapter(self.log, traceid)

        log.debug("checking if service connected")
        if self._connected:
Severity: Minor
Found in cocaine/detail/service.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

Function _get_token has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def _get_token(self):
        try:
            # TODO: Seems too many branches with common ending.
            if self._to_expire:
                if time.time() > self._to_expire:
Severity: Minor
Found in cocaine/detail/secadaptor.py - About 25 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 locators has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def locators(self):
        if not self._locators:
            try:
                value = self.get_opt("--locator")
                if self.protocol == 0:
Severity: Minor
Found in cocaine/detail/defaults.py - About 25 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

Severity
Category
Status
Source
Language