smok-serwis/coolamqp

View on GitHub

Showing 449 of 449 total issues

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

    def __eq__(self, other):  # type: (Exchange) -> bool
        return (self.name == other.name) and (type(self) == type(other))
Severity: Major
Found in coolamqp/objects.py and 1 other location - About 1 hr to fix
coolamqp/objects.py on lines 263..264

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 cancel has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

    def cancel(self):  # type: () -> Future
        """
        Cancel the customer.

        .ack() or .nack() for messages from this customer will have no effect.
Severity: Minor
Found in coolamqp/attaches/consumer.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

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

    def __eq__(self, other):
        return (self.name == other.name) and (type(self) == type(other))
Severity: Major
Found in coolamqp/objects.py and 1 other location - About 1 hr to fix
coolamqp/objects.py on lines 214..215

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 watch_for_method has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def watch_for_method(self, channel,  # type: int
Severity: Major
Found in coolamqp/uplink/connection/connection.py - About 1 hr to fix

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

        def __init__(self, name=u'',  # type: tp.Union[str, bytes]
    Severity: Major
    Found in coolamqp/objects.py - About 1 hr to fix

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

          def __init__(self, connection,  # type: coolamqp.uplink.connection.Connection
      Severity: Major
      Found in coolamqp/uplink/handshake.py - About 1 hr to fix

        Function method_and_watch has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def method_and_watch(self, channel_id,  # type: int
        Severity: Major
        Found in coolamqp/uplink/connection/connection.py - About 1 hr to fix

          Consider simplifying this complex logical expression.
          Open

                  if self.frame_type is None and self.total_data_len > 0:
                      self.frame_type = self._extract_single_byte()
          
                      if self.frame_type not in (
                              FRAME_HEARTBEAT, FRAME_HEADER, FRAME_METHOD, FRAME_BODY):
          Severity: Major
          Found in coolamqp/uplink/connection/recv_framer.py - About 1 hr to fix

            Function declare has 8 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def declare(self, obj,  # type: tp.Union[Queue, Exchange]
            Severity: Major
            Found in coolamqp/clustering/cluster.py - About 1 hr to fix

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

                  def on_fail(self):
                      """
                      Called by event loop when the underlying connection is closed.
              
                      This means the connection is dead, cannot be used anymore, and all operations
              Severity: Minor
              Found in coolamqp/uplink/connection/connection.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

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

                      if span is not None and not dont_trace:
                          child_span = self._make_span('declare', span)
                      else:
                          child_span = None
              Severity: Major
              Found in coolamqp/clustering/cluster.py and 2 other locations - About 55 mins to fix
              coolamqp/clustering/cluster.py on lines 108..111
              coolamqp/clustering/cluster.py on lines 192..195

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

              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 confirm has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def confirm(self, delivery_tag, success):  # type: (int, tp.Callable[[], None]) -> None
                      """
                      This crafts a constructor for confirming messages.
              
                      This should return a callable/0, whose calling will ACK or REJECT the
              Severity: Minor
              Found in coolamqp/attaches/consumer.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

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

                      if span is not None and not dont_trace:
                          child_span = self._make_span('consume', span)
                      else:
                          child_span = None
              Severity: Major
              Found in coolamqp/clustering/cluster.py and 2 other locations - About 55 mins to fix
              coolamqp/clustering/cluster.py on lines 108..111
              coolamqp/clustering/cluster.py on lines 131..134

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

              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

                      if span is not None and not dont_trace:
                          child_span = self._make_span('bind', span)
                      else:
                          child_span = None
              Severity: Major
              Found in coolamqp/clustering/cluster.py and 2 other locations - About 55 mins to fix
              coolamqp/clustering/cluster.py on lines 131..134
              coolamqp/clustering/cluster.py on lines 192..195

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

              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 __init__ has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def __init__(self, node_definition,  # type: coolamqp.objects.NodeDefinition
              Severity: Major
              Found in coolamqp/uplink/connection/connection.py - About 50 mins to fix

                Function consume has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def consume(self, queue, on_message=None, span=None,
                Severity: Major
                Found in coolamqp/clustering/cluster.py - About 50 mins to fix

                  Function _pub has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def _pub(self, message, exchange_name, routing_key, parent_span=None, span_enqueued=None,
                  Severity: Major
                  Found in coolamqp/attaches/publisher.py - About 50 mins to fix

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

                        def _mode_cnpub_process_deliveries(self):
                            """
                            Dispatch all frames that are waiting to be sent
                    
                            To be used when  mode is MODE_CNPUB and we just got ST_ONLINE
                    Severity: Minor
                    Found in coolamqp/attaches/publisher.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

                    Avoid deeply nested control flow statements.
                    Open

                                            if opt[0] == tag:
                                                stop = index + 1
                                                break
                                        else:
                    Severity: Major
                    Found in coolamqp/attaches/utils.py - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                              if opt[0] == tag:
                                                  stop += 1  # this is exactly this tag. Adjust stop to end one further (Python slicing) and stop
                                                  break
                                              if opt[0] > tag:
                      Severity: Major
                      Found in coolamqp/attaches/utils.py - About 45 mins to fix
                        Severity
                        Category
                        Status
                        Source
                        Language