snake-soft/django-oscar-product-tables

View on GitHub

Showing 6 of 8 total issues

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

    def save(self, **data):
        for code, value in data.items():
            attribute = self.product.product_class.attributes.get(code=code)
            if attribute.type == 'option':
                if value:
Severity: Minor
Found in src/oscar_product_tables/cell.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 post has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def post(self, request, product_id, code,  action, *args, **kwargs):
Severity: Minor
Found in src/oscar_product_tables/dashboard/views.py - About 45 mins to fix

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

        def setup(self, request, product_id, code, *args, **kwargs):
    Severity: Minor
    Found in src/oscar_product_tables/dashboard/views.py - About 35 mins to fix

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

          def __init__(self, queryset=None, plugin_classes=None, product=None,
      Severity: Minor
      Found in src/oscar_product_tables/table.py - About 35 mins to fix

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

            def get(self, request, product_id, code, *args, **kwargs):
        Severity: Minor
        Found in src/oscar_product_tables/dashboard/views.py - About 35 mins to fix

          Function get_queryset has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
          Open

              def get_queryset(self, plugin_classes, queryset, product):
                  qs = queryset
                  if product:
                      if not queryset:
                          qs = Product.objects.all()
          Severity: Minor
          Found in src/oscar_product_tables/table.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