jacquev6/LowVoltage

View on GitHub

Showing 53 of 329 total issues

File get_item.py has 258 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# coding: utf8

# Copyright 2014-2015 Vincent Jacques <vincent@vincent-jacques.net>

"""
Severity: Minor
Found in LowVoltage/actions/get_item.py - About 2 hrs to fix

    UpdateItem has 21 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class UpdateItem(Action):
        """
        The `UpdateItem request <http://docs.aws.amazon.com/amazondynamodb/latest/APIReference/API_UpdateItem.html#API_UpdateItem_RequestParameters>`__.
        """
    
    
    Severity: Minor
    Found in LowVoltage/actions/update_item.py - About 2 hrs to fix

      Function __raise has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def __raise(self, status_code, r):
              try:
                  data = r.json()
              except ValueError:
                  data = r.text
      Severity: Minor
      Found in LowVoltage/connection/connection.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

      Function _convert_db_to_value has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

      def _convert_db_to_value(value):
          if "S" in value:
              return value["S"]
          elif "B" in value:
              return bytes(base64.b64decode(value["B"].encode("utf8")))
      Severity: Minor
      Found in LowVoltage/actions/conversion.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

      Function __call__ has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

          def __call__(self, action):
              """
              Send requests and return responses.
              """
              errors = []
      Severity: Minor
      Found in LowVoltage/connection/connection.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

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

          def __init__(
      Severity: Major
      Found in LowVoltage/actions/return_types.py - About 1 hr to fix

        Function iterate_batch_get_item has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
        Open

        def iterate_batch_get_item(connection, table, *keys):
            """
            Make as many :class:`.BatchGetItem` actions as needed to iterate over all specified items.
            Including processing :attr:`.BatchGetItemResponse.unprocessed_keys`.
        
        
        Severity: Minor
        Found in LowVoltage/compounds/iterate_batch_get_item.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

        Function test_different_statuses has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def test_different_statuses(self):
                self.requests_response.expect.status_code.andReturn(400)
                self.requests_response.expect.json().andReturn({})
                with self.assertRaises(_exn.ClientError):
                    self.responder(self.response_class.object, self.requests_response.object)
        Severity: Minor
        Found in LowVoltage/connection/connection.py - About 1 hr to fix

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

              def __init__(
          Severity: Major
          Found in LowVoltage/actions/return_types.py - About 1 hr to fix

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

                def payload(self):
                    # @todo Simplify, make more linear
                    data = {}
                    data.update(self.__table_name.payload)
                    schema = []
            Severity: Minor
            Found in LowVoltage/actions/create_table.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__(
            Severity: Minor
            Found in LowVoltage/actions/return_types.py - About 45 mins to fix

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

                  def __init__(
              Severity: Minor
              Found in LowVoltage/actions/return_types.py - About 45 mins to fix

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

                    def __init__(
                Severity: Minor
                Found in LowVoltage/actions/query.py - About 45 mins to fix

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

                          def payload(self):
                              data = {"IndexName": self.__name}
                              schema = []
                              if self._hash_key:
                                  schema.append({"AttributeName": self._hash_key, "KeyType": "HASH"})
                  Severity: Minor
                  Found in LowVoltage/actions/update_table.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 __init__ has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def __init__(
                  Severity: Minor
                  Found in LowVoltage/actions/return_types.py - About 45 mins to fix

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

                        def __init__(
                    Severity: Minor
                    Found in LowVoltage/actions/scan.py - About 45 mins to fix

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

                          def __init__(self, region, credentials, endpoint=None, retry_policy=None, requests_session=None):
                      Severity: Minor
                      Found in LowVoltage/connection/connection.py - About 35 mins to fix

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

                            def __call__(self, key, secret, now, action, payload):
                        Severity: Minor
                        Found in LowVoltage/connection/connection.py - About 35 mins to fix

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

                          def batch_put_item(connection, table, *items):
                              """
                              Make as many :class:`.BatchWriteItem` actions as needed to put all specified items.
                              Including processing :attr:`.BatchWriteItemResponse.unprocessed_items`.
                          
                          
                          Severity: Minor
                          Found in LowVoltage/compounds/batch_put_item.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 batch_delete_item has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                          Open

                          def batch_delete_item(connection, table, *keys):
                              """
                              Make as many :class:`.BatchWriteItem` actions as needed to delete all specified keys.
                              Including processing :attr:`.BatchWriteItemResponse.unprocessed_items`.
                          
                          
                          Severity: Minor
                          Found in LowVoltage/compounds/batch_delete_item.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

                          Severity
                          Category
                          Status
                          Source
                          Language