MediaMath/t1-python

View on GitHub

Showing 132 of 132 total issues

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

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

                  try:
                      exc = STATUS_CODES[status_code]
                  except KeyError:
                      self.status_code = False
                      raise T1Error(status_code, message)
          Severity: Minor
          Found in terminalone/xmlparser.py and 1 other location - About 35 mins to fix
          terminalone/jsonparser.py on lines 82..86

          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 _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

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

              _push.update({
                  'audience_segment_exclude_op': _seg_incexc_ops,
                  'audience_segment_include_op': _seg_incexc_ops,
                  'bid_price_is_media_only': int,
                  'end_date': partial(t1types.strft, null_on_none=True),
          Severity: Minor
          Found in terminalone/models/strategy.py and 1 other location - About 35 mins to fix
          terminalone/models/campaign.py on lines 98..130

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

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

                  try:
                      exc = STATUS_CODES[status_code]
                  except KeyError:
                      self.status_code = False
                      raise T1Error(status_code, status_code)
          Severity: Minor
          Found in terminalone/jsonparser.py and 1 other location - About 35 mins to fix
          terminalone/xmlparser.py on lines 63..67

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

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

              _push.update({
                  'conversion_type': _conv,
                  'dcs_data_is_campaign_level': int,
                  'end_date': t1types.strft,
                  'frequency_interval': _cap_ints,
          Severity: Minor
          Found in terminalone/models/campaign.py and 1 other location - About 35 mins to fix
          terminalone/models/strategy.py on lines 97..129

          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

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

              def save_deals(self, data):
                  url = self._construct_url(addl=['deals', ])
                  self._save_related(data, url)
          Severity: Minor
          Found in terminalone/models/strategy.py and 1 other location - About 30 mins to fix
          terminalone/models/strategy.py on lines 172..174

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

          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

          Avoid too many return statements within this function.
          Open

                      return ent_gen
          Severity: Major
          Found in terminalone/service.py - About 30 mins to fix

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

                def save_supplies(self, data):
                    url = self._construct_url(addl=['supplies', ])
                    self._save_related(data, url)
            Severity: Minor
            Found in terminalone/models/strategy.py and 1 other location - About 30 mins to fix
            terminalone/models/strategy.py on lines 176..178

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

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

                def add(self, group, target):
                    """Add target value by ID or instance to group"""
                    url = ['target_values', 0]
                    if isinstance(target, TargetValue):
                        group.append(target)
            Severity: Minor
            Found in terminalone/models/targetdimension.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