spicycms/spicy.core

View on GitHub
src/spicy/core/profile/forms.py

Summary

Maintainability
F
4 days
Test Coverage

File forms.py has 514 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
import re
import datetime as dt
from copy import copy
from captcha.conf.settings import get_challenge, CAPTCHA_FLITE_PATH
Severity: Major
Found in src/spicy/core/profile/forms.py - About 1 day to fix

    Function clean_email has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def clean_email(self):
            email = self.cleaned_data['email']
            username = self.cleaned_data.get('username')
            if self.strict and self.cleaned_data['is_registration']:
                if not username:
    Severity: Minor
    Found in src/spicy/core/profile/forms.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

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

        def clean_password2(self):
            if self.cleaned_data['is_registration']:
                password1 = self.cleaned_data.get('password1', '').strip()
                password2 = self.cleaned_data.get('password2', '').strip()
                if password1 and password2:
    Severity: Minor
    Found in src/spicy/core/profile/forms.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 clean_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def clean_email(self):
            email = self.cleaned_data['email']
            if email:
                try:
                    Profile.objects.get(email__iexact=email)
    Severity: Minor
    Found in src/spicy/core/profile/forms.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 __init__ has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def __init__(self, *args, **kwargs):
            # Path request=None to auth form or it eats our data!
            super(SigninForm, self).__init__(None, *args, **kwargs)
    
            # We inherit username and password from AuthenticationForm,
    Severity: Minor
    Found in src/spicy/core/profile/forms.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 clean_email has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def clean_email(self):
            email = self.cleaned_data['email']
            if email:
                try:
                    if Profile.objects.filter(email__iexact=email).count():
    Severity: Minor
    Found in src/spicy/core/profile/forms.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

    class ProfileFiltersForm(forms.Form):
        group = forms.ModelChoiceField(
            label=_('Group'), queryset=Group.objects.all(), required=False)
        group.widget.attrs['class'] = 'uniform'
        search_text = forms.CharField(max_length=100, required=False)
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 1 other location - About 3 hrs to fix
    src/spicy/core/trash/forms.py on lines 11..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 66.

    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 clean_email(self):
            email = self.cleaned_data['email']
            if Profile.objects.filter(email=email).exclude(
                    pk=self.instance.pk).exists():
                raise forms.ValidationError(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 1 other location - About 3 hrs to fix
    src/spicy/core/profile/forms.py on lines 471..476

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

    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 clean_username(self):
            username = self.cleaned_data['username']
            if Profile.objects.filter(username=username).exclude(
                    pk=self.instance.pk).exists():
                raise forms.ValidationError(_('Username must be unique'))
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 1 other location - About 3 hrs to fix
    src/spicy/core/profile/forms.py on lines 478..484

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

    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

        groups = forms.ModelMultipleChoiceField(
            label=_('Groups'), required=False,
            widget=widgets.FilteredSelectMultiple(_("Groups"), is_stacked=False),
            queryset=Group.objects.all())
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 1 other location - About 1 hr to fix
    src/spicy/core/profile/forms.py on lines 168..172

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

    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

        user_permissions = forms.ModelMultipleChoiceField(
            label=_('Permissions'), required=False,
            widget=widgets.FilteredSelectMultiple(
                _("Permissions"), is_stacked=False),
            queryset=Permission.objects.all())
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 1 other location - About 1 hr to fix
    src/spicy/core/profile/forms.py on lines 159..162

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

    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

        groups = forms.ModelMultipleChoiceField(
            label=_('Groups'), required=False,
            widget=forms.SelectMultiple(attrs={'class': 'SelectMultiple'}),
            queryset=Group.objects.all())
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 1 other location - About 1 hr to fix
    src/spicy/core/profile/forms.py on lines 163..167

    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

        sites = forms.ModelMultipleChoiceField(
            label=_('Sites'), required=False,
            widget=forms.SelectMultiple(
                attrs={'class': 'SelectMultiple nosearch'}),
            queryset=Site.objects.all())
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 1 other location - About 1 hr to fix
    src/spicy/core/profile/forms.py on lines 353..356

    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

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

        username = forms.RegexField(
            label=_('Username'), max_length=30, regex=r'^[\w\-_]+$',
            help_text=_(
                "Required. 30 characters or fewer. Alphanumeric characters only "
                "(letters, digits and underscores)."),
    Severity: Minor
    Found in src/spicy/core/profile/forms.py and 1 other location - About 55 mins to fix
    src/spicy/core/profile/forms.py on lines 189..194

    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

        username = forms.RegexField(
            label=_('Username'), max_length=30, regex=r'^[\w\-_]+$',
            help_text=_(
                "Required. 30 characters or fewer. Alphanumeric characters only "
                "(letters, digits and underscores)."),
    Severity: Minor
    Found in src/spicy/core/profile/forms.py and 1 other location - About 55 mins to fix
    src/spicy/core/profile/forms.py on lines 134..139

    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

            if password1 and password2:
                if password1 != password2:
                    raise forms.ValidationError(
                        _("The two password fields didn't match."))
                return password2
    Severity: Minor
    Found in src/spicy/core/profile/forms.py and 1 other location - About 45 mins to fix
    src/spicy/core/profile/forms.py on lines 573..577

    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

                if password1 and password2:
                    if password1 != password2:
                        raise forms.ValidationError(
                            _("The two password fields didn't match."))
                    return password2
    Severity: Minor
    Found in src/spicy/core/profile/forms.py and 1 other location - About 45 mins to fix
    src/spicy/core/profile/forms.py on lines 386..390

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

        first_name = forms.RegexField(
            label=_('First name'), max_length=30, regex=NAME_RE,
            error_message=_(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 8 other locations - About 35 mins to fix
    src/spicy/core/profile/forms.py on lines 95..97
    src/spicy/core/profile/forms.py on lines 101..103
    src/spicy/core/profile/forms.py on lines 141..143
    src/spicy/core/profile/forms.py on lines 147..149
    src/spicy/core/profile/forms.py on lines 153..155
    src/spicy/core/profile/forms.py on lines 196..198
    src/spicy/core/profile/forms.py on lines 202..204
    src/spicy/core/profile/forms.py on lines 208..210

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

        second_name = forms.RegexField(
            label=_('Second name'), max_length=30, regex=NAME_RE,
            error_message=_(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 8 other locations - About 35 mins to fix
    src/spicy/core/profile/forms.py on lines 89..91
    src/spicy/core/profile/forms.py on lines 101..103
    src/spicy/core/profile/forms.py on lines 141..143
    src/spicy/core/profile/forms.py on lines 147..149
    src/spicy/core/profile/forms.py on lines 153..155
    src/spicy/core/profile/forms.py on lines 196..198
    src/spicy/core/profile/forms.py on lines 202..204
    src/spicy/core/profile/forms.py on lines 208..210

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

        last_name = forms.RegexField(
            label=_('Last name'), max_length=30, regex=NAME_RE,
            error_message=_(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 8 other locations - About 35 mins to fix
    src/spicy/core/profile/forms.py on lines 89..91
    src/spicy/core/profile/forms.py on lines 95..97
    src/spicy/core/profile/forms.py on lines 141..143
    src/spicy/core/profile/forms.py on lines 147..149
    src/spicy/core/profile/forms.py on lines 153..155
    src/spicy/core/profile/forms.py on lines 196..198
    src/spicy/core/profile/forms.py on lines 202..204
    src/spicy/core/profile/forms.py on lines 208..210

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

        first_name = forms.RegexField(
            label=_('First name'), max_length=30, regex=NAME_RE,
            error_message=_(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 8 other locations - About 35 mins to fix
    src/spicy/core/profile/forms.py on lines 89..91
    src/spicy/core/profile/forms.py on lines 95..97
    src/spicy/core/profile/forms.py on lines 101..103
    src/spicy/core/profile/forms.py on lines 147..149
    src/spicy/core/profile/forms.py on lines 153..155
    src/spicy/core/profile/forms.py on lines 196..198
    src/spicy/core/profile/forms.py on lines 202..204
    src/spicy/core/profile/forms.py on lines 208..210

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

        second_name = forms.RegexField(
            label=_('Second name'), max_length=30, regex=NAME_RE,
            error_message=_(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 8 other locations - About 35 mins to fix
    src/spicy/core/profile/forms.py on lines 89..91
    src/spicy/core/profile/forms.py on lines 95..97
    src/spicy/core/profile/forms.py on lines 101..103
    src/spicy/core/profile/forms.py on lines 141..143
    src/spicy/core/profile/forms.py on lines 153..155
    src/spicy/core/profile/forms.py on lines 196..198
    src/spicy/core/profile/forms.py on lines 202..204
    src/spicy/core/profile/forms.py on lines 208..210

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

        last_name = forms.RegexField(
            label=_('Last name'), max_length=30, regex=NAME_RE,
            error_message=_(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 8 other locations - About 35 mins to fix
    src/spicy/core/profile/forms.py on lines 89..91
    src/spicy/core/profile/forms.py on lines 95..97
    src/spicy/core/profile/forms.py on lines 101..103
    src/spicy/core/profile/forms.py on lines 141..143
    src/spicy/core/profile/forms.py on lines 147..149
    src/spicy/core/profile/forms.py on lines 153..155
    src/spicy/core/profile/forms.py on lines 196..198
    src/spicy/core/profile/forms.py on lines 202..204

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

        last_name = forms.RegexField(
            label=_('Last name'), max_length=30, regex=NAME_RE,
            error_message=_(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 8 other locations - About 35 mins to fix
    src/spicy/core/profile/forms.py on lines 89..91
    src/spicy/core/profile/forms.py on lines 95..97
    src/spicy/core/profile/forms.py on lines 101..103
    src/spicy/core/profile/forms.py on lines 141..143
    src/spicy/core/profile/forms.py on lines 147..149
    src/spicy/core/profile/forms.py on lines 196..198
    src/spicy/core/profile/forms.py on lines 202..204
    src/spicy/core/profile/forms.py on lines 208..210

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

        first_name = forms.RegexField(
            label=_('First name'), max_length=30, regex=NAME_RE,
            error_message=_(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 8 other locations - About 35 mins to fix
    src/spicy/core/profile/forms.py on lines 89..91
    src/spicy/core/profile/forms.py on lines 95..97
    src/spicy/core/profile/forms.py on lines 101..103
    src/spicy/core/profile/forms.py on lines 141..143
    src/spicy/core/profile/forms.py on lines 147..149
    src/spicy/core/profile/forms.py on lines 153..155
    src/spicy/core/profile/forms.py on lines 202..204
    src/spicy/core/profile/forms.py on lines 208..210

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

        second_name = forms.RegexField(
            label=_('Second name'), max_length=30, regex=NAME_RE,
            error_message=_(
    Severity: Major
    Found in src/spicy/core/profile/forms.py and 8 other locations - About 35 mins to fix
    src/spicy/core/profile/forms.py on lines 89..91
    src/spicy/core/profile/forms.py on lines 95..97
    src/spicy/core/profile/forms.py on lines 101..103
    src/spicy/core/profile/forms.py on lines 141..143
    src/spicy/core/profile/forms.py on lines 147..149
    src/spicy/core/profile/forms.py on lines 153..155
    src/spicy/core/profile/forms.py on lines 196..198
    src/spicy/core/profile/forms.py on lines 208..210

    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