jardiacaj/finem_imperii

View on GitHub
messaging/tests.py

Summary

Maintainability
F
6 days
Test Coverage

File tests.py has 501 lines of code (exceeds 250 allowed). Consider refactoring.
Open

from django.contrib import auth
from django.contrib.auth.models import User
from django.test import TestCase
from django.urls.base import reverse

Severity: Major
Found in messaging/tests.py - About 1 day to fix

    Function test_add_and_remove_contact has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def test_add_and_remove_contact(self):
            target_character = Character.objects.get(id=3)
    
            response = self.client.get(reverse('messaging:compose'))
            self.assertContains(response, target_character.name, count=1)
    Severity: Minor
    Found in messaging/tests.py - About 1 hr to fix

      Function test_message_favourite_unfavourite has 32 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def test_message_favourite_unfavourite(self):
              message_body = 'Nice to meet you, foobar.'
              response = self.client.post(
                  reverse('messaging:compose'),
                  data={
      Severity: Minor
      Found in messaging/tests.py - About 1 hr to fix

        Function test_mark_as_read has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def test_mark_as_read(self):
                message_body = 'Nice to meet you, foobar.'
                response = self.client.post(
                    reverse('messaging:compose'),
                    data={
        Severity: Minor
        Found in messaging/tests.py - About 1 hr to fix

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

              def test_send_and_mark_favourite_non_own_message(self):
                  message_body = 'Nice to meet you, foobar.'
                  response = self.client.post(
                      reverse('messaging:compose'),
                      data={
          Severity: Major
          Found in messaging/tests.py and 1 other location - About 2 days to fix
          messaging/tests.py on lines 320..341

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

          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

              def test_send_and_mark_read_non_own_message(self):
                  message_body = 'Nice to meet you, foobar.'
                  response = self.client.post(
                      reverse('messaging:compose'),
                      data={
          Severity: Major
          Found in messaging/tests.py and 1 other location - About 2 days to fix
          messaging/tests.py on lines 343..364

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

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

              def test_compose_view(self):
                  response = self.client.get(reverse('messaging:compose'))
                  self.assertEqual(response.status_code, 200)
          Severity: Major
          Found in messaging/tests.py and 4 other locations - About 45 mins to fix
          account/tests.py on lines 92..94
          account/tests.py on lines 155..157
          base/tests.py on lines 9..11
          help/tests.py on lines 5..8

          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

          There are no issues that match your filters.

          Category
          Status