ctxis/lather

View on GitHub

Showing 52 of 52 total issues

Avoid deeply nested control flow statements.
Open

                        if instance.company in update_companies:
                            kwargs.update(
                                { self.model._meta.default_id: instance.id })
                            #self.client = instance.client
                            #if not self.client:
Severity: Major
Found in lather/managers.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                            if not isinstance(instance, Instance):
                                raise TypeError(
                                    'The list must contain Key objects')
                            self.client = instance.client
    Severity: Major
    Found in lather/managers.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                              if inst == obj:
                                  obj_keys = obj.get_instances()
                                  inst_keys = inst.get_instances()
                                  obj_keys.extend(inst_keys)
                                  found = True
      Severity: Major
      Found in lather/managers.py - About 45 mins to fix

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

            def _check_kwargs(self, method, **kwargs):
                page = self.model._meta.page
                params = self.model.client.get_service_params(method, page)
        
                # Because elements are suds.sax.text.Text, convert them to str
        Severity: Minor
        Found in lather/managers.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 not super(NavQuerySet, self).delete(**tmp_dict):
                                    success = False
                            if success:
        Severity: Major
        Found in lather/managers.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                      if not super(NavQuerySet, self).delete(**kwargs):
                                          success = False
                                  except WebFault:
          Severity: Major
          Found in lather/managers.py - About 45 mins to fix

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

                def update(self, obj=None, **kwargs):
                    if obj:
                        if self.queryset:
                            for inst in self.queryset:
                                kwargs.update({self.model._meta.default_id:
            Severity: Minor
            Found in lather/managers.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

                                    for company in existing_companies:
                                        if company in add_companies:
                                            update_companies.append(company)
                                            add_companies.pop(add_companies.index(company))
                                        else:
            Severity: Major
            Found in lather/managers.py - About 45 mins to fix

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

                  def __init__(self, name=None, max_length=None, min_length=None,
              Severity: Minor
              Found in lather/models.py - About 35 mins to fix

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

                    def __eq__(self, other):
                        """
                        Exam if two objects are equal
                        """
                        for field in self._meta.get_field_names():
                Severity: Minor
                Found in lather/models.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 _set_endpoints has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def _set_endpoints(self, endpoints):
                        for endpoint in endpoints.keys():
                            if endpoints.get(endpoint):
                                setattr(self, endpoint, endpoints[endpoint]['method'])
                
                
                Severity: Minor
                Found in lather/models.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 filter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                Open

                    def filter(self, **kwargs):
                        index = 0
                        params = {}
                        filters = []
                
                
                Severity: Minor
                Found in lather/managers.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