juntagrico/juntagrico

View on GitHub

Showing 11 of 19 total issues

Subscription has 41 functions (exceeds 25 allowed). Consider refactoring.
Open

class Subscription(Billable, SimpleStateModel):
    '''
    One Subscription that may be shared among several people.
    '''
    depot = models.ForeignKey(
Severity: Minor
Found in juntagrico/entity/subs.py - About 4 hrs to fix

    Function job has a Cognitive Complexity of 35 (exceeds 15 allowed). Consider refactoring.
    Open

    def job(request, job_id):
        '''
        Details for a job
        '''
        member = request.user.member
    Severity: Minor
    Found in juntagrico/views.py - About 3 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

    Consider simplifying this complex logical expression.
    Open

        if (c == 'N' and g == 'M') or ((c == 'G' or c == 'D') and g == 'F'):
            article = _('der')
        elif c == 'G' and (g == 'M' or g == 'N'):
            article = _('des')
        elif c == 'D' and (g == 'M' or g == 'N'):
    Severity: Critical
    Found in juntagrico/util/organisation_name.py - About 3 hrs to fix

      Member has 26 functions (exceeds 25 allowed). Consider refactoring.
      Open

      class Member(JuntagricoBaseModel):
          '''
          Additional fields for Django's default user class.
          '''
      
      
      Severity: Minor
      Found in juntagrico/entity/member.py - About 2 hrs to fix

        Function set_up_job has 30 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def set_up_job(self):
                """
                job_type
                """
                job_type_data = {'name': 'nameot',
        Severity: Minor
        Found in test/util/test.py - About 1 hr to fix

          Function excel_export_subscriptions has 27 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          def excel_export_subscriptions(request):
              response = HttpResponse(content_type='application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
              response['Content-Disposition'] = 'attachment; filename=Report.xlsx'
              output = BytesIO()
              workbook = Workbook(output)
          Severity: Minor
          Found in juntagrico/views_admin.py - About 1 hr to fix

            Function handle has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def handle(self, *args, **options):
                    subprod_field = {'name': 'Gemüse'}
                    sub_product, created = SubscriptionProduct.objects.get_or_create(**subprod_field)
            
                    subsize_fields = {'name': 'Normales Abo', 'long_name': 'Ganz Normales Abo', 'units': options['sub_size'],
            Severity: Minor
            Found in juntagrico/management/commands/generate_testdata_advanced.py - About 1 hr to fix

              Function mass_edit_share_dates has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring.
              Open

                  def mass_edit_share_dates(self, request, queryset):
                      if 'apply' in request.POST:
                          form = EditShareDatesForm(request.POST)
                          if form.is_valid():
                              target_field = form.cleaned_data['target_field']
              Severity: Minor
              Found in juntagrico/admins/share_admin.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 enriched_organisation has a Cognitive Complexity of 19 (exceeds 15 allowed). Consider refactoring.
              Open

              def enriched_organisation(c):
                  g = Config.organisation_name_config()['gender'].upper()
                  if (c == 'N' and g == 'M') or ((c == 'G' or c == 'D') and g == 'F'):
                      article = _('der')
                  elif c == 'G' and (g == 'M' or g == 'N'):
              Severity: Minor
              Found in juntagrico/util/organisation_name.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

              Avoid too many return statements within this function.
              Open

                          return 'cs-shares'
              Severity: Major
              Found in juntagrico/util/sessions.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return 'cs-summary'
                Severity: Major
                Found in juntagrico/util/sessions.py - About 30 mins to fix
                  Severity
                  Category
                  Status
                  Source
                  Language