aldryn/aldryn-jobs

View on GitHub

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

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

            migrations.CreateModel(
                name='JobCategoriesPlugin',
                fields=[
                    ('cmsplugin_ptr', models.OneToOneField(auto_created=True, parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
                ],
    Severity: Major
    Found in aldryn_jobs/migrations/0001_initial.py and 1 other location - About 1 hr to fix
    aldryn_jobs/migrations/0001_initial.py on lines 93..101

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

    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

            migrations.CreateModel(
                name='JobListPlugin',
                fields=[
                    ('cmsplugin_ptr', models.OneToOneField(auto_created=True, parent_link=True, primary_key=True, serialize=False, to='cms.CMSPlugin')),
                ],
    Severity: Major
    Found in aldryn_jobs/migrations/0001_initial.py and 1 other location - About 1 hr to fix
    aldryn_jobs/migrations/0001_initial.py on lines 52..60

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

    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

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

            if 'app_config' in self.fields:
                # if has only one choice, select it by default
                if self.fields['app_config'].queryset.count() == 1:
                    self.fields['app_config'].empty_label = None
    Severity: Major
    Found in aldryn_jobs/forms.py and 1 other location - About 1 hr to fix
    aldryn_jobs/forms.py on lines 267..268

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

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

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

            if self.fields['app_config'].queryset.count() == 1:
                    self.fields['app_config'].empty_label = None
    Severity: Major
    Found in aldryn_jobs/forms.py and 1 other location - About 1 hr to fix
    aldryn_jobs/forms.py on lines 43..46

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

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

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

            migrations.AddField(
                model_name='joblistplugin',
                name='app_config',
                field=models.ForeignKey(verbose_name='app configuration', help_text='Select appropriate app. configuration for this plugin.', null=True, to='aldryn_jobs.JobsConfig'),
    Severity: Minor
    Found in aldryn_jobs/migrations/0001_initial.py and 1 other location - About 45 mins to fix
    aldryn_jobs/migrations/0001_initial.py on lines 195..198

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

    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

            migrations.AlterField(
                model_name='jobcategoriesplugin',
                name='cmsplugin_ptr',
                field=models.OneToOneField(parent_link=True, related_name='aldryn_jobs_jobcategoriesplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'),
    Severity: Minor
    Found in aldryn_jobs/migrations/0003_auto_20160714_1512.py and 1 other location - About 45 mins to fix
    aldryn_jobs/migrations/0003_auto_20160714_1512.py on lines 25..28

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

    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

            migrations.AddField(
                model_name='jobcategoriesplugin',
                name='app_config',
                field=models.ForeignKey(verbose_name='app configuration', help_text='Select appropriate app. configuration for this plugin.', null=True, to='aldryn_jobs.JobsConfig'),
    Severity: Minor
    Found in aldryn_jobs/migrations/0001_initial.py and 1 other location - About 45 mins to fix
    aldryn_jobs/migrations/0001_initial.py on lines 167..170

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

    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

            migrations.AlterField(
                model_name='joblistplugin',
                name='cmsplugin_ptr',
                field=models.OneToOneField(parent_link=True, related_name='aldryn_jobs_joblistplugin', primary_key=True, serialize=False, to='cms.CMSPlugin'),
    Severity: Minor
    Found in aldryn_jobs/migrations/0003_auto_20160714_1512.py and 1 other location - About 45 mins to fix
    aldryn_jobs/migrations/0003_auto_20160714_1512.py on lines 20..23

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

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