MediaMath/t1-python

View on GitHub

Showing 51 of 132 total issues

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

    def remove(self, group, target):
        """Remove target value by ID or instance from group"""
        target_values = dict((target_value.id, target_value)
                             for target_value in group)
        if isinstance(target, list):
Severity: Minor
Found in terminalone/models/targetdimension.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 _detect_auth_method has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

def _detect_auth_method(username, password, session_id,
Severity: Major
Found in terminalone/service.py - About 50 mins to fix

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

        def fetch_resource_owner_password_token(self, username, password,
    Severity: Major
    Found in terminalone/connection.py - About 50 mins to fix

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

          def __init__(self, body):
              self.status_code = False
              try:
                  parsed_data = json.loads(body)
              except ValueError as e:
      Severity: Minor
      Found in terminalone/jsonparser.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 new has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def new(self, collection, report=None, properties=None, version=None, *args, **kwargs):
      Severity: Minor
      Found in terminalone/service.py - About 45 mins to fix

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

        def add_metaclass(metaclass):
            """Class decorator for creating a class with a metaclass."""
            def wrapper(cls):
                orig_vars = cls.__dict__.copy()
                slots = orig_vars.get('__slots__')
        Severity: Minor
        Found in terminalone/vendor/six.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 find has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def find(self, collection, variable, operator, candidates, **kwargs):
        Severity: Minor
        Found in terminalone/service.py - About 35 mins to fix

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

              def _return_class(self, ent_dict,
          Severity: Minor
          Found in terminalone/service.py - About 35 mins to fix

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

                def _gen_classes(self, entities, child, child_id, entity_id, collection):
            Severity: Minor
            Found in terminalone/service.py - About 35 mins to fix

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

                  def __init__(self, session, report=None, properties=None, version=None, **kwargs):
              Severity: Minor
              Found in terminalone/reports.py - About 35 mins to fix

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

                    def __init__(self, name, old_mod, new_mod, old_attr=None, new_attr=None):
                Severity: Minor
                Found in terminalone/vendor/six.py - About 35 mins to fix

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

                      def __init__(self,
                  Severity: Minor
                  Found in terminalone/connection.py - About 35 mins to fix

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

                        def get(self, as_dict=False):
                            """Get report data. Returns tuple (headers, csv.Reader).
                    
                            If as_dict == True, return (headers, csv.DictReader).
                            """
                    Severity: Minor
                    Found in terminalone/reports.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 _generate_save_data has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _generate_save_data(self, data=None):
                            if data is None:
                                data = self._properties.copy()
                                data.pop('organization', None)
                                data.pop('agency', None)
                    Severity: Minor
                    Found in terminalone/models/permission.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 int_or_none has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def int_or_none(value, null_on_none=False):
                        if value is not None:
                            if not isinstance(value, int):
                                raise TypeError('must supply int')
                            return value
                    Severity: Minor
                    Found in terminalone/t1types.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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def save(self, data=None, url=None):
                            """Save object to T1 while accounting for old fields"""
                            if data is None:
                                data = self._properties.copy()
                    
                    
                    Severity: Minor
                    Found in terminalone/models/campaign.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 save has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def save(self, data=None, url=None):
                            """Extra validation for data pixels
                    
                            :param data: dict optional data to use instead of self
                            :return: None. Object is updated or error is raised
                    Severity: Minor
                    Found in terminalone/models/pixelbundle.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 generate_pmpd_tag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                    def generate_pmpd_tag(tag_type, placement_slot, publisher_site, publisher):
                        """Generate PMP-D tag from already-created values.
                    
                        :param tag_type: enum{'iframe', 'js', 'js/iframe'} type of tag
                        :param placement_slot: PlacementSlot instance
                    Severity: Minor
                    Found in terminalone/utils/pmpd.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 dictify_permission has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def dictify_permission(entity):
                            """Turn XML permission into a dictionary"""
                            if not entity:
                                return
                            output = {}
                    Severity: Minor
                    Found in terminalone/xmlparser.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_all has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def _get_all(self, collection, **kwargs):
                            """Construct iterator to get all entities in a collection.
                    
                            Pages over 100 entities.
                            This method should not be called directly: it's called from T1.get.
                    Severity: Minor
                    Found in terminalone/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

                    Severity
                    Category
                    Status
                    Source
                    Language