tomi77/django-extra-tools

View on GitHub
django_extra_tools/db/models/timestampable.py

Summary

Maintainability
B
6 hrs
Test Coverage

Function save_by has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def save_by(self, user, force_insert=False, force_update=False, using=None,
Severity: Minor
Found in django_extra_tools/db/models/timestampable.py - About 45 mins to fix

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

    class UpdatedAtMixin(models.Model):
        """Add ``updated_at`` field to model."""
        updated_at = models.DateTimeField(auto_now=True, null=True, blank=True,
                                          verbose_name=_('Date of last update'))
    
    
    Severity: Major
    Found in django_extra_tools/db/models/timestampable.py and 1 other location - About 1 hr to fix
    django_extra_tools/db/models/timestampable.py on lines 10..17

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

    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 CreatedAtMixin(models.Model):
        """Add ``created_at`` field to model."""
        created_at = models.DateTimeField(auto_now_add=True,
                                          null=False, blank=True,
                                          verbose_name=_('Creation date'))
    Severity: Major
    Found in django_extra_tools/db/models/timestampable.py and 1 other location - About 1 hr to fix
    django_extra_tools/db/models/timestampable.py on lines 34..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 44.

    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

        deleted_by = models.ForeignKey(
            settings.AUTH_USER_MODEL,
            db_column='deleted_by',
            on_delete=models.CASCADE,
            null=True, blank=True,
    Severity: Major
    Found in django_extra_tools/db/models/timestampable.py and 2 other locations - About 1 hr to fix
    django_extra_tools/db/models/timestampable.py on lines 22..28
    django_extra_tools/db/models/timestampable.py on lines 45..51

    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

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

        created_by = models.ForeignKey(
            settings.AUTH_USER_MODEL,
            db_column='created_by',
            on_delete=models.CASCADE,
            null=False, blank=True,
    Severity: Major
    Found in django_extra_tools/db/models/timestampable.py and 2 other locations - About 1 hr to fix
    django_extra_tools/db/models/timestampable.py on lines 45..51
    django_extra_tools/db/models/timestampable.py on lines 77..83

    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

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

        updated_by = models.ForeignKey(
            settings.AUTH_USER_MODEL,
            db_column='updated_by',
            on_delete=models.CASCADE,
            null=True, blank=True,
    Severity: Major
    Found in django_extra_tools/db/models/timestampable.py and 2 other locations - About 1 hr to fix
    django_extra_tools/db/models/timestampable.py on lines 22..28
    django_extra_tools/db/models/timestampable.py on lines 77..83

    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

    There are no issues that match your filters.

    Category
    Status