mangroveorg/datawinners

View on GitHub
datawinners/project/views/views.py

Summary

Maintainability
F
6 days
Test Coverage

File views.py has 921 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# vim: ai ts=4 sts=4 et sw=4 encoding=utf-8
import json
import datetime
import logging

Severity: Major
Found in datawinners/project/views/views.py - About 2 days to fix

    Function broadcast_message has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def broadcast_message(request, project_id):
        dbm = get_database_manager(request.user)
        questionnaire = Project.get(dbm, project_id)
        if questionnaire.is_poll:
             return HttpResponseRedirect('/project/'+ project_id + '/results/'+questionnaire.form_code)
    Severity: Minor
    Found in datawinners/project/views/views.py - About 2 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

    Function create_data_sender_and_web_user has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

    def create_data_sender_and_web_user(request, project_id):
        manager = get_database_manager(request.user)
        questionnaire = Project.get(manager, project_id)
        project_links = get_project_link(questionnaire)
        dashboard_page = settings.HOME_PAGE + "?deleted=true"
    Severity: Minor
    Found in datawinners/project/views/views.py - About 2 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

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

    def questionnaire(request, project_id):
        manager = get_database_manager(request.user)
        if request.method == 'GET':
            #TODO: on questionnaire edit page, this is loading twice, unnecessary. Need to investigate
            #First as normal request, Second time as ajax request
    Severity: Minor
    Found in datawinners/project/views/views.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 rename_project has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def rename_project(request, project_id):
        user = request.user
        organization = Organization.objects.get(org_id=user.get_profile().org_id)
        manager = get_database_manager(user)
        questionnaire = Project.get(manager, project_id)
    Severity: Minor
    Found in datawinners/project/views/views.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 project_overview has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
    Open

    def project_overview(request, project_id):
        manager = get_database_manager(request.user)
        questionnaire = Project.get(manager, project_id)
        if questionnaire.is_poll:
             return HttpResponseRedirect('/project/'+ project_id + '/results/'+questionnaire.form_code)
    Severity: Minor
    Found in datawinners/project/views/views.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 success_response has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def success_response(self, is_update, organization, questionnaire_form):
            success_message = None
            error_message = None
            try:
                created_request = helper.create_request(questionnaire_form, self.request.user.username, is_update=is_update)
    Severity: Minor
    Found in datawinners/project/views/views.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 too many return statements within this function.
    Open

            return render_to_response('project/broadcast_message.html',
    Severity: Major
    Found in datawinners/project/views/views.py - About 30 mins to fix

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

      def questionnaire_preview(request, project_id=None, sms_preview=False):
          manager = get_database_manager(request.user)
          if request.method == 'GET':
              dashboard_page = settings.HOME_PAGE + "?deleted=true"
              questionnaire = Project.get(manager, project_id)
      Severity: Minor
      Found in datawinners/project/views/views.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 response_for_post_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def response_for_post_request(self, is_update=None):
              questionnaire_form = self.form(self.request.POST)
              quota_reached = is_quota_reached(self.request)
              reporter_id = NGOUserProfile.objects.get(user=self.request.user).reporter_id
              is_linked = self.reporter_id in self.questionnaire.data_senders
      Severity: Minor
      Found in datawinners/project/views/views.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

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

              except DataObjectNotFound as exception:
                  logger.exception(exception)
                  message = exception_messages.get(DataObjectNotFound).get(WEB)
                  error_message = _(message) % (self.form_model.entity_type[0], self.form_model.entity_type[0])
      Severity: Major
      Found in datawinners/project/views/views.py and 1 other location - About 3 hrs to fix
      datawinners/project/views/views.py on lines 732..735

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

      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

              except DataObjectNotFound as exception:
                  logger.exception(exception)
                  message = exception_messages.get(DataObjectNotFound).get(WEB)
                  error_message = _(message) % (self.questionnaire.entity_type[0], self.questionnaire.entity_type[0])
      Severity: Major
      Found in datawinners/project/views/views.py and 1 other location - About 3 hrs to fix
      datawinners/project/views/views.py on lines 618..621

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

      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

              return render_to_response('project/questionnaire_preview_list.html',
                                        {"questions": datasender_questions,
                                         'questionnaire_code': registration_questionnaire.form_code,
                                         'project': questionnaire, 'project_links': project_links,
                                         'is_quota_reached': is_quota_reached(request),
      Severity: Major
      Found in datawinners/project/views/views.py and 1 other location - About 1 hr to fix
      datawinners/project/views/views.py on lines 846..852

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

      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

              return render_to_response('project/questionnaire_preview_list.html',
                                        {"questions": questions, 'questionnaire_code': registration_questionnaire.form_code,
                                         'project': questionnaire, 'project_links': project_links,
                                         'is_quota_reached': is_quota_reached(request),
                                         'example_sms': example_sms,
      Severity: Major
      Found in datawinners/project/views/views.py and 1 other location - About 1 hr to fix
      datawinners/project/views/views.py on lines 868..875

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

      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

              except DataObjectAlreadyExists as exception:
                  error_message = _("%s with ID Number '%s' already exists or has previously collected data.") % (exception.data[2], exception.data[1])
      Severity: Major
      Found in datawinners/project/views/views.py and 1 other location - About 1 hr to fix
      datawinners/entity/views.py on lines 678..679

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

      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

              for entity_type in questionnaire.entity_type:
                  subject_links.update({entity_type: append_query_strings_to_url(reverse("subject_questionnaire", args=[project_id, entity_type]),
      Severity: Major
      Found in datawinners/project/views/views.py and 1 other location - About 1 hr to fix
      datawinners/alldata/views.py on lines 71..73

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

      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

          if request.method == 'GET':
              return survey_request.response_for_get_request()
          elif request.method == 'POST':
              return survey_request.response_for_post_request()
      Severity: Major
      Found in datawinners/project/views/views.py and 1 other location - About 1 hr to fix
      datawinners/project/views/views.py on lines 779..782

      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

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

          if request.method == 'GET':
              return subject_request.response_for_get_request()
          elif request.method == 'POST':
              return subject_request.post()
      Severity: Major
      Found in datawinners/project/views/views.py and 1 other location - About 1 hr to fix
      datawinners/project/views/views.py on lines 764..767

      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

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

                  entity_fields = dbm.view.registration_form_model_by_entity_type(key=[entity_type], include_docs=True)[0]["doc"]["json_fields"]
      Severity: Major
      Found in datawinners/project/views/views.py and 2 other locations - About 1 hr to fix
      datawinners/entity/geo_data.py on lines 14..14
      datawinners/entity/views.py on lines 517..517

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

      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

                                     'unique_id_types': json.dumps([{"name":unique_id_type.capitalize(),
                                                                    "value":unique_id_type} for unique_id_type in
                                                                   get_unique_id_types(manager) if unique_id_type != entity_type]),
      Severity: Minor
      Found in datawinners/project/views/views.py and 1 other location - About 55 mins to fix
      datawinners/entity/views.py on lines 735..737

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

      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

              except Exception as exception:
                  logger.exception('Web Submission failure:-')
                  error_message = _(get_exception_message_for(exception=exception, channel=Channel.WEB))
      Severity: Minor
      Found in datawinners/project/views/views.py and 1 other location - About 45 mins to fix
      datawinners/project/views/views.py on lines 624..626

      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

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

              except Exception as exception:
                  logger.exception('Web Submission failure:-')
                  error_message = _(get_exception_message_for(exception=exception, channel=Channel.WEB))
      Severity: Minor
      Found in datawinners/project/views/views.py and 1 other location - About 45 mins to fix
      datawinners/project/views/views.py on lines 736..738

      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

                  if form.requires_web_access():
                      email_id = request.POST['email']
                      create_single_web_user(org_id=org_id, email_address=email_id, reporter_id=reporter_id,
                                             language_code=request.LANGUAGE_CODE)
      Severity: Minor
      Found in datawinners/project/views/views.py and 1 other location - About 40 mins to fix
      datawinners/entity/view/datasenders.py on lines 186..190

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

      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 7 locations. Consider refactoring.
      Open

          if questionnaire.is_poll:
               return HttpResponseRedirect('/project/'+ project_id + '/results/'+questionnaire.form_code)
      Severity: Major
      Found in datawinners/project/views/views.py and 6 other locations - About 35 mins to fix
      datawinners/project/views/change_language.py on lines 26..27
      datawinners/project/views/views.py on lines 169..170
      datawinners/project/views/views.py on lines 281..282
      datawinners/project/views/views.py on lines 408..409
      datawinners/project/views/views.py on lines 455..456
      datawinners/project/wizard_view.py on lines 182..183

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

      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 7 locations. Consider refactoring.
      Open

          if questionnaire.is_poll:
               return HttpResponseRedirect('/project/'+ project_id + '/results/'+questionnaire.form_code)
      Severity: Major
      Found in datawinners/project/views/views.py and 6 other locations - About 35 mins to fix
      datawinners/project/views/change_language.py on lines 26..27
      datawinners/project/views/views.py on lines 169..170
      datawinners/project/views/views.py on lines 281..282
      datawinners/project/views/views.py on lines 316..317
      datawinners/project/views/views.py on lines 455..456
      datawinners/project/wizard_view.py on lines 182..183

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

      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 7 locations. Consider refactoring.
      Open

              if questionnaire.is_poll:
                  return HttpResponseRedirect('/project/'+ project_id + '/results/'+questionnaire.form_code)
      Severity: Major
      Found in datawinners/project/views/views.py and 6 other locations - About 35 mins to fix
      datawinners/project/views/change_language.py on lines 26..27
      datawinners/project/views/views.py on lines 169..170
      datawinners/project/views/views.py on lines 281..282
      datawinners/project/views/views.py on lines 316..317
      datawinners/project/views/views.py on lines 408..409
      datawinners/project/wizard_view.py on lines 182..183

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

      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 7 locations. Consider refactoring.
      Open

          if questionnaire.is_poll:
               return HttpResponseRedirect('/project/'+ project_id + '/results/'+questionnaire.form_code)
      Severity: Major
      Found in datawinners/project/views/views.py and 6 other locations - About 35 mins to fix
      datawinners/project/views/change_language.py on lines 26..27
      datawinners/project/views/views.py on lines 281..282
      datawinners/project/views/views.py on lines 316..317
      datawinners/project/views/views.py on lines 408..409
      datawinners/project/views/views.py on lines 455..456
      datawinners/project/wizard_view.py on lines 182..183

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

      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 7 locations. Consider refactoring.
      Open

          if questionnaire.is_poll:
               return HttpResponseRedirect('/project/'+ project_id + '/results/'+questionnaire.form_code)
      Severity: Major
      Found in datawinners/project/views/views.py and 6 other locations - About 35 mins to fix
      datawinners/project/views/change_language.py on lines 26..27
      datawinners/project/views/views.py on lines 169..170
      datawinners/project/views/views.py on lines 316..317
      datawinners/project/views/views.py on lines 408..409
      datawinners/project/views/views.py on lines 455..456
      datawinners/project/wizard_view.py on lines 182..183

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

      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

      There are no issues that match your filters.

      Category
      Status