aldryn/aldryn-jobs

View on GitHub

Showing 9 of 17 total issues

Function populate has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring.
Open

    def populate(self):
        def can(actions, model):
            try:
                # Py2
                basestring = basestring
Severity: Minor
Found in aldryn_jobs/cms_toolbars.py - About 4 hrs 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

File models.py has 267 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
from __future__ import unicode_literals

from django import get_version
from django.conf import settings
Severity: Minor
Found in aldryn_jobs/models.py - About 2 hrs to fix

    Function get_jobopening_from_path has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def get_jobopening_from_path(path, language, current_url=None):
        # There is an issue with resolve(path) which is related to django cache
        # (django functools memoize) which uses usual dict and cannot be disabled
        # that leads to a Resolver404 because that cache contains wrong language
        # url resolver. Since request at the moment of calling this function
    Severity: Minor
    Found in aldryn_jobs/cms_toolbars.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 send_staff_notifications has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def send_staff_notifications(self):
            recipients = list(self.instance.job_opening.get_notification_emails())
            if DEFAULT_SEND_TO:
                recipients += [DEFAULT_SEND_TO]
    
    
    Severity: Minor
    Found in aldryn_jobs/forms.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 __call__ has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def __call__(self, modeladmin, request, queryset, *args, **kwargs):
    Severity: Minor
    Found in aldryn_jobs/admin.py - About 35 mins to fix

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

          def __call__(self, modeladmin, request, queryset, *args, **kwargs):
      Severity: Minor
      Found in aldryn_jobs/admin.py - About 35 mins to fix

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

        def _send_rejection_email(modeladmin, request, queryset, lang_code='',
        Severity: Minor
        Found in aldryn_jobs/admin.py - About 35 mins to fix

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

          def create_default_newsblog_config(apps, schema_editor):
              # copied and adapted from
              # https://github.com/aldryn/aldryn-newsblog/blob/e447eecd97227613f4c7d960c293794be21b746e/aldryn_newsblog/migrations/0007_default_newsblog_config.py#L20-L70
              import cms.models.fields
              from cms.models import Placeholder
          Severity: Minor
          Found in aldryn_jobs/migrations/0002_default_appconfig.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 clean has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
          Open

              def clean(self):
                  data = super(JobListPluginForm, self).clean()
                  # save only events for selected app_config
                  selected = data.get('jobopenings', [])
                  app_config = data.get('app_config')
          Severity: Minor
          Found in aldryn_jobs/forms.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