uclouvain/osis-dissertation

View on GitHub

Showing 75 of 75 total issues

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

        for document in documents:
            document.delete()
            old_document = mdl_osis_common.document_file.find_by_id(document.document_file.id)
            old_document.delete()
Severity: Minor
Found in views/upload_dissertation_file.py and 1 other location - About 55 mins to fix
views/upload_proposition_file.py on lines 98..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 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

        for document in documents:
            document.delete()
            old_document = mdl_osis_common.document_file.find_by_id(document.document_file.id)
            old_document.delete()
Severity: Minor
Found in views/upload_proposition_file.py and 1 other location - About 55 mins to fix
views/upload_dissertation_file.py on lines 106..109

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

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

    @property
    def in_periode_jury_visibility(self):
        start = self.start_jury_visibility
        end = self.end_jury_visibility

Severity: Major
Found in models/offer_proposition.py and 3 other locations - About 55 mins to fix
models/offer_proposition.py on lines 93..98
models/offer_proposition.py on lines 100..105
models/offer_proposition.py on lines 114..119

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

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

    @property
    def in_periode_visibility_dissertation(self):
        start = self.start_visibility_dissertation
        end = self.end_visibility_dissertation

Severity: Major
Found in models/offer_proposition.py and 3 other locations - About 55 mins to fix
models/offer_proposition.py on lines 93..98
models/offer_proposition.py on lines 107..112
models/offer_proposition.py on lines 114..119

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

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

        queryset=OfferProposition.objects.annotate(last_acronym=Subquery(
            EducationGroupYear.objects.filter(
                education_group__offer_proposition=OuterRef('pk'),
Severity: Minor
Found in views/proposition_dissertation.py and 1 other location - About 50 mins to fix
views/proposition_dissertation.py on lines 566..568

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

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

    offer_propositions = OfferProposition.objects.exclude(education_group=None).annotate(last_acronym=Subquery(
        EducationGroupYear.objects.filter(
            education_group__offer_proposition=OuterRef('pk'),
Severity: Minor
Found in views/proposition_dissertation.py and 1 other location - About 50 mins to fix
views/proposition_dissertation.py on lines 106..108

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

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 add has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def add(person, type_arg, available_by_email, available_by_phone, available_at_office, comment):
Severity: Minor
Found in models/adviser.py - About 45 mins to fix

    Function proposition_dissertation_edit has a Cognitive Complexity of 11 (exceeds 8 allowed). Consider refactoring.
    Open

    def proposition_dissertation_edit(request, pk):
        proposition = proposition_dissertation.find_by_id(pk)
        if proposition is None:
            return redirect('proposition_dissertations')
        adv = get_current_adviser(request)
    Severity: Minor
    Found in views/proposition_dissertation.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

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

    class DissertationRoleAdmin(SerializableModelAdmin):
        list_display = ('adviser', 'status', 'dissertation', 'author', 'dissertation_status')
        raw_id_fields = ('adviser', 'dissertation')
        search_fields = ('uuid', 'dissertation__author__person__last_name', 'dissertation__author__person__first_name',
                         'dissertation__title', 'adviser__person__last_name', 'adviser__person__first_name')
    Severity: Minor
    Found in models/dissertation_role.py and 1 other location - About 45 mins to fix
    models/dissertation_update.py on lines 38..42

    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

    class DissertationUpdateAdmin(SerializableModelAdmin):
        list_display = ('dissertation', 'status_from', 'status_to', 'person', 'created')
        raw_id_fields = ('person', 'dissertation')
        search_fields = ('uuid', 'dissertation__title', 'person__last_name', 'person__first_name',
                         'dissertation__author__person__last_name', 'dissertation__author__person__first_name')
    Severity: Minor
    Found in models/dissertation_update.py and 1 other location - About 45 mins to fix
    models/dissertation_role.py on lines 36..40

    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

    Consider simplifying this complex logical expression.
    Open

            if offer_prop.validation_commission_exists and dissert.status == 'DIR_SUBMIT':
    
                return 'COM_SUBMIT'
    
            elif offer_prop.evaluation_first_year and (dissert.status == 'DIR_SUBMIT' or
    Severity: Major
    Found in models/dissertation.py - About 40 mins to fix

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

      def search(terms, active=None, visibility=None, connected_adviser=None, education_groups=None):
      Severity: Minor
      Found in models/proposition_dissertation.py - About 35 mins to fix

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

                    if is_valid(request, form):
                        proposition = edit_proposition(form, proposition_offers, request)
                        return redirect('proposition_dissertation_detail', pk=proposition.pk)
        Severity: Minor
        Found in views/proposition_dissertation.py and 1 other location - About 35 mins to fix
        views/proposition_dissertation.py on lines 189..191

        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

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

                if is_valid(request, form):
                    proposition = edit_proposition(form, proposition_offers, request)
                    return redirect('manager_proposition_dissertation_detail', pk=proposition.pk)
        Severity: Minor
        Found in views/proposition_dissertation.py and 1 other location - About 35 mins to fix
        views/proposition_dissertation.py on lines 504..506

        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

        Avoid too many return statements within this function.
        Open

                    return 'COM_SUBMIT'
        Severity: Major
        Found in models/dissertation.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                      return 'EVA_SUBMIT'
          Severity: Major
          Found in models/dissertation.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                        return 'DIR_KO'
            Severity: Major
            Found in models/dissertation.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return dissert.status
              Severity: Major
              Found in models/dissertation.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                        return dissert.status
                Severity: Major
                Found in models/dissertation.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return 'EVA_KO'
                  Severity: Major
                  Found in models/dissertation.py - About 30 mins to fix
                    Severity
                    Category
                    Status
                    Source
                    Language