559Labs/django-dtg-store-manager

View on GitHub

Showing 302 of 302 total issues

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

urlpatterns += (
    # urls for bzCreativeCollection
    url(r'^bzcreativecollection/$', bzCreativeCollectionListView.as_view(),
        name='business_bzcreativecollection_list'),
    url(r'^bzcreativecollection/create/$',
Severity: Major
Found in src/business/urls.py and 33 other locations - About 3 hrs to fix
src/business/urls.py on lines 83..90
src/business/urls.py on lines 118..124
src/business/urls.py on lines 204..212
src/business/urls.py on lines 227..236
src/business/urls.py on lines 239..248
src/business/urls.py on lines 251..260
src/business/urls.py on lines 263..272
src/business/urls.py on lines 275..284
src/business/urls.py on lines 287..296
src/business/urls.py on lines 299..308
src/business/urls.py on lines 311..319
src/business/urls.py on lines 322..331
src/business/urls.py on lines 334..343
src/business/urls.py on lines 346..354
src/business/urls.py on lines 357..365
src/business/urls.py on lines 368..376
src/business/urls.py on lines 379..388
src/business/urls.py on lines 391..399
src/business/urls.py on lines 402..411
src/business/urls.py on lines 414..423
src/business/urls.py on lines 426..434
src/business/urls.py on lines 437..446
src/business/urls.py on lines 449..458
src/business/urls.py on lines 461..470
src/business/urls.py on lines 473..482
src/business/urls.py on lines 485..494
src/business/urls.py on lines 497..506
src/business/urls.py on lines 509..518
src/business/urls.py on lines 521..530
src/business/urls.py on lines 533..542
src/business/urls.py on lines 545..554
src/business/urls.py on lines 557..565
src/business/urls.py on lines 568..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 64.

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

urlpatterns += (
    # urls for wooImage
    url(r'^wooimage/$', wooImageListView.as_view(), name='business_wooimage_list'),
    url(r'^wooimage/create/$', wooImageCreateView.as_view(),
        name='business_wooimage_create'),
Severity: Major
Found in src/business/urls.py and 33 other locations - About 3 hrs to fix
src/business/urls.py on lines 83..90
src/business/urls.py on lines 118..124
src/business/urls.py on lines 204..212
src/business/urls.py on lines 215..224
src/business/urls.py on lines 227..236
src/business/urls.py on lines 239..248
src/business/urls.py on lines 251..260
src/business/urls.py on lines 263..272
src/business/urls.py on lines 275..284
src/business/urls.py on lines 287..296
src/business/urls.py on lines 299..308
src/business/urls.py on lines 322..331
src/business/urls.py on lines 334..343
src/business/urls.py on lines 346..354
src/business/urls.py on lines 357..365
src/business/urls.py on lines 368..376
src/business/urls.py on lines 379..388
src/business/urls.py on lines 391..399
src/business/urls.py on lines 402..411
src/business/urls.py on lines 414..423
src/business/urls.py on lines 426..434
src/business/urls.py on lines 437..446
src/business/urls.py on lines 449..458
src/business/urls.py on lines 461..470
src/business/urls.py on lines 473..482
src/business/urls.py on lines 485..494
src/business/urls.py on lines 497..506
src/business/urls.py on lines 509..518
src/business/urls.py on lines 521..530
src/business/urls.py on lines 533..542
src/business/urls.py on lines 545..554
src/business/urls.py on lines 557..565
src/business/urls.py on lines 568..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 64.

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

urlpatterns += (
    # urls for pfSyncVariant
    url(r'^pfsyncvariant/$', pfSyncVariantListView.as_view(),
        name='business_pfsyncvariant_list'),
    url(r'^pfsyncvariant/create/$', pfSyncVariantCreateView.as_view(),
Severity: Major
Found in src/business/urls.py and 33 other locations - About 3 hrs to fix
src/business/urls.py on lines 83..90
src/business/urls.py on lines 118..124
src/business/urls.py on lines 204..212
src/business/urls.py on lines 215..224
src/business/urls.py on lines 227..236
src/business/urls.py on lines 239..248
src/business/urls.py on lines 251..260
src/business/urls.py on lines 263..272
src/business/urls.py on lines 275..284
src/business/urls.py on lines 287..296
src/business/urls.py on lines 299..308
src/business/urls.py on lines 311..319
src/business/urls.py on lines 322..331
src/business/urls.py on lines 334..343
src/business/urls.py on lines 346..354
src/business/urls.py on lines 357..365
src/business/urls.py on lines 368..376
src/business/urls.py on lines 379..388
src/business/urls.py on lines 391..399
src/business/urls.py on lines 402..411
src/business/urls.py on lines 414..423
src/business/urls.py on lines 426..434
src/business/urls.py on lines 437..446
src/business/urls.py on lines 461..470
src/business/urls.py on lines 473..482
src/business/urls.py on lines 485..494
src/business/urls.py on lines 497..506
src/business/urls.py on lines 509..518
src/business/urls.py on lines 521..530
src/business/urls.py on lines 533..542
src/business/urls.py on lines 545..554
src/business/urls.py on lines 557..565
src/business/urls.py on lines 568..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 64.

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

urlpatterns += (
    url(r'^product/$', appProductHome.as_view(), name='app_product_home'),
    url(r'^product/create/$',
        bzProductFormWizard.as_view(), name="app_product_create"),
    url(r'^product/view/(?P<product>\S+)/$',
Severity: Major
Found in src/business/urls.py and 33 other locations - About 3 hrs to fix
src/business/urls.py on lines 118..124
src/business/urls.py on lines 204..212
src/business/urls.py on lines 215..224
src/business/urls.py on lines 227..236
src/business/urls.py on lines 239..248
src/business/urls.py on lines 251..260
src/business/urls.py on lines 263..272
src/business/urls.py on lines 275..284
src/business/urls.py on lines 287..296
src/business/urls.py on lines 299..308
src/business/urls.py on lines 311..319
src/business/urls.py on lines 322..331
src/business/urls.py on lines 334..343
src/business/urls.py on lines 346..354
src/business/urls.py on lines 357..365
src/business/urls.py on lines 368..376
src/business/urls.py on lines 379..388
src/business/urls.py on lines 391..399
src/business/urls.py on lines 402..411
src/business/urls.py on lines 414..423
src/business/urls.py on lines 426..434
src/business/urls.py on lines 437..446
src/business/urls.py on lines 449..458
src/business/urls.py on lines 461..470
src/business/urls.py on lines 473..482
src/business/urls.py on lines 485..494
src/business/urls.py on lines 497..506
src/business/urls.py on lines 509..518
src/business/urls.py on lines 521..530
src/business/urls.py on lines 533..542
src/business/urls.py on lines 545..554
src/business/urls.py on lines 557..565
src/business/urls.py on lines 568..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 64.

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

urlpatterns += (
    # urls for pfCatalogFileSpec
    url(r'^pfcatalogfilespec/$', pfCatalogFileSpecListView.as_view(),
        name='business_pfcatalogfilespec_list'),
    url(r'^pfcatalogfilespec/create/$', pfCatalogFileSpecCreateView.as_view(),
Severity: Major
Found in src/business/urls.py and 33 other locations - About 3 hrs to fix
src/business/urls.py on lines 83..90
src/business/urls.py on lines 118..124
src/business/urls.py on lines 204..212
src/business/urls.py on lines 215..224
src/business/urls.py on lines 227..236
src/business/urls.py on lines 239..248
src/business/urls.py on lines 251..260
src/business/urls.py on lines 263..272
src/business/urls.py on lines 275..284
src/business/urls.py on lines 287..296
src/business/urls.py on lines 299..308
src/business/urls.py on lines 311..319
src/business/urls.py on lines 322..331
src/business/urls.py on lines 334..343
src/business/urls.py on lines 346..354
src/business/urls.py on lines 357..365
src/business/urls.py on lines 368..376
src/business/urls.py on lines 379..388
src/business/urls.py on lines 391..399
src/business/urls.py on lines 402..411
src/business/urls.py on lines 414..423
src/business/urls.py on lines 426..434
src/business/urls.py on lines 437..446
src/business/urls.py on lines 449..458
src/business/urls.py on lines 461..470
src/business/urls.py on lines 473..482
src/business/urls.py on lines 485..494
src/business/urls.py on lines 509..518
src/business/urls.py on lines 521..530
src/business/urls.py on lines 533..542
src/business/urls.py on lines 545..554
src/business/urls.py on lines 557..565
src/business/urls.py on lines 568..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 64.

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

urlpatterns += (
    # urls for pfCatalogOptionType
    url(r'^pfcatalogoptiontype/$', pfCatalogOptionTypeListView.as_view(),
        name='business_pfcatalogoptiontype_list'),
    url(r'^pfcatalogoptiontype/create/$',
Severity: Major
Found in src/business/urls.py and 33 other locations - About 3 hrs to fix
src/business/urls.py on lines 83..90
src/business/urls.py on lines 118..124
src/business/urls.py on lines 204..212
src/business/urls.py on lines 215..224
src/business/urls.py on lines 227..236
src/business/urls.py on lines 239..248
src/business/urls.py on lines 251..260
src/business/urls.py on lines 263..272
src/business/urls.py on lines 275..284
src/business/urls.py on lines 287..296
src/business/urls.py on lines 299..308
src/business/urls.py on lines 311..319
src/business/urls.py on lines 322..331
src/business/urls.py on lines 334..343
src/business/urls.py on lines 346..354
src/business/urls.py on lines 357..365
src/business/urls.py on lines 368..376
src/business/urls.py on lines 379..388
src/business/urls.py on lines 391..399
src/business/urls.py on lines 402..411
src/business/urls.py on lines 414..423
src/business/urls.py on lines 426..434
src/business/urls.py on lines 437..446
src/business/urls.py on lines 449..458
src/business/urls.py on lines 461..470
src/business/urls.py on lines 473..482
src/business/urls.py on lines 485..494
src/business/urls.py on lines 497..506
src/business/urls.py on lines 509..518
src/business/urls.py on lines 533..542
src/business/urls.py on lines 545..554
src/business/urls.py on lines 557..565
src/business/urls.py on lines 568..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 64.

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 __str__(self):
        rv = []
        if self.code and self.base_url:
            return "{} - {}".format(self.code, self.base_url)
        elif self.code:
Severity: Major
Found in src/business/models.py and 1 other location - About 3 hrs to fix
src/business/models.py on lines 107..113

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

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 __str__(self):
        rv = []
        if self.code and self.name:
            return "{} - {}".format(self.code, self.name)
        elif self.code:
Severity: Major
Found in src/business/models.py and 1 other location - About 3 hrs to fix
src/business/models.py on lines 261..267

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

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

Cyclomatic complexity is too high in method save. (12)
Open

    def save(self, *args, **kwargs):
        if self.width and not self.width_in:
            self.width_in = int(self.width / 300)
        elif self.width_in and not self.width:
            self.width = self.width_in * 300
Severity: Minor
Found in src/business/models.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

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

    def __str__(self):
        if self.code and self.name:
            return "{} - {}".format(self.code, self.name)
        elif self.name:
            return "{}".format(self.name)
Severity: Major
Found in src/business/models.py and 4 other locations - About 2 hrs to fix
src/business/models.py on lines 58..63
src/business/models.py on lines 392..397
src/business/models.py on lines 1003..1008
src/business/models.py on lines 1075..1080

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

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

Cyclomatic complexity is too high in method asHTML. (11)
Open

    def asHTML(self):
        """
        Returns an HTML div, formatted in a 'standard' way:

            Name
Severity: Minor
Found in src/business/models.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

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

    def __str__(self):
        if self.code and self.name:
            return "{} - {}".format(self.code, self.name)
        elif self.name:
            return "{}".format(self.name)
Severity: Major
Found in src/business/models.py and 4 other locations - About 2 hrs to fix
src/business/models.py on lines 293..298
src/business/models.py on lines 392..397
src/business/models.py on lines 1003..1008
src/business/models.py on lines 1075..1080

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

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 __str__(self):
        if self.code and self.name:
            return "{} - {}".format(self.code, self.name)
        elif self.name:
            return "{}".format(self.name)
Severity: Major
Found in src/business/models.py and 4 other locations - About 2 hrs to fix
src/business/models.py on lines 58..63
src/business/models.py on lines 293..298
src/business/models.py on lines 392..397
src/business/models.py on lines 1075..1080

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

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 __str__(self):
        if self.code and self.name:
            return "{} - {}".format(self.code, self.name)
        elif self.name:
            return "{}".format(self.name)
Severity: Major
Found in src/business/models.py and 4 other locations - About 2 hrs to fix
src/business/models.py on lines 58..63
src/business/models.py on lines 293..298
src/business/models.py on lines 392..397
src/business/models.py on lines 1003..1008

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

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 __str__(self):
        if self.code and self.name:
            return "{} - {}".format(self.code, self.name)
        elif self.name:
            return "{}".format(self.name)
Severity: Major
Found in src/business/models.py and 4 other locations - About 2 hrs to fix
src/business/models.py on lines 58..63
src/business/models.py on lines 293..298
src/business/models.py on lines 1003..1008
src/business/models.py on lines 1075..1080

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

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

Cyclomatic complexity is too high in method __str__. (8)
Open

    def __str__(self):
        rv = []
        if self.bzcreativecollection:
            if self.bzcreativecollection.code:
                rv.append(self.bzcreativecollection.code + "-")
Severity: Minor
Found in src/business/models.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

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

    def api_pull(store=None, key=None):
        """
        Update the product objects from the Printful API.

        :param store: Optional bzStore object. If not provided, method will
Severity: Minor
Found in src/business/models.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

Cyclomatic complexity is too high in method api_pull. (7)
Open

    @staticmethod
    def api_pull(store=None, key=None):
        """
        Update the product objects from the Printful API.

Severity: Minor
Found in src/business/models.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

Cyclomatic complexity is too high in class pfAddress. (7)
Open

class pfAddress(commonBusinessModel):
    # Fields
    name = CharField(_("Name"), max_length=255,
                     default="", blank=True, null=True)
    company = CharField(_("Company"), max_length=255,
Severity: Minor
Found in src/business/models.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

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

class wooVariantAdmin(admin.ModelAdmin):
    form = wooVariantAdminForm
    list_display = ['id', 'date_added', 'date_updated', 'is_active',
                    'wid', 'date_created',
                    'permalink', 'sku', 'price', 'dimension_length',
Severity: Major
Found in src/business/admin.py and 2 other locations - About 1 hr to fix
src/business/admin.py on lines 171..180
src/business/admin.py on lines 211..220

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

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

Severity
Category
Status
Source
Language