michal-stuglik/django-mips

View on GitHub

Showing 17 of 17 total issues

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

class SampleSubspeciesMommy(TestCase):
    def setUp(self):
        self.o = mommy.make(SampleSubspecies)

    def tearDown(self):
Severity: Major
Found in mips/tests.py and 1 other location - About 5 hrs to fix
mips/tests.py on lines 53..63

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

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 SubspeciesTestMommy(TestCase):
    def setUp(self):
        self.o = mommy.make(Subspecies)

    def tearDown(self):
Severity: Major
Found in mips/tests.py and 1 other location - About 5 hrs to fix
mips/tests.py on lines 66..75

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Function mips_for_reference_list has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
Open

def mips_for_reference_list(lista):

    for ref in lista:
        for mip in Mip.objects.filter(reference_id=ref):
            print ref, mip.mip_id, ['immuno' if mip.mip_func_immuno else '-'][0], ['mapping' if mip.mip_func_mapping else '-'][0], \
Severity: Minor
Found in mips/example/examples2.py - About 1 hr 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 load_samples has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def load_samples(file_path):
    print 'Function {} ...'.format(load_samples.__name__)

    header_read = False
    with open(file_path, 'r') as f:
Severity: Minor
Found in mips/data_manager/import_methods.py - About 1 hr 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 load_paralogs has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def load_paralogs(file_path):
    print 'Function {} ...'.format(load_paralogs.__name__)

    header_read = False
    with open(file_path, 'r') as f:
Severity: Minor
Found in mips/data_manager/import_methods.py - About 1 hr 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 load_mips has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def load_mips(file_path):
    """Insert/Update mip objects. """

    print 'Function {} ...'.format(load_mips.__name__)

Severity: Minor
Found in mips/data_manager/import_methods.py - About 1 hr 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 load_sample_subspecies has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def load_sample_subspecies(file_path):
    print 'Function {} ...'.format(load_sample_subspecies.__name__)

    header_read = False
    with open(file_path, 'r') as f:
Severity: Minor
Found in mips/data_manager/import_methods.py - About 1 hr 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 load_mip_instances has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def load_mip_instances(file_path):
    print 'Function {} ...'.format(load_mip_instances.__name__)

    header_read = False
    with open(file_path, 'r') as f:
Severity: Minor
Found in mips/data_manager/import_methods.py - About 1 hr 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 load_subspecies has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

def load_subspecies(file_path):
    print 'Function {} ...'.format(load_subspecies.__name__)

    header_read = False
    with open(file_path, 'r') as f:
Severity: Minor
Found in mips/data_manager/import_methods.py - About 1 hr 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 6 locations. Consider refactoring.
Open

            if not header_read:
                if cmp(row_as_list, paralogs_input_schema) != 0:
                    raise Exception(
                        "Mixed field names/order between tables:\nDefined table:{}\nImported table:{}".format(
                            paralogs_input_schema,
Severity: Major
Found in mips/data_manager/import_methods.py and 5 other locations - About 1 hr to fix
mips/data_manager/import_methods.py on lines 66..73
mips/data_manager/import_methods.py on lines 132..139
mips/data_manager/import_methods.py on lines 173..180
mips/data_manager/import_methods.py on lines 216..223
mips/data_manager/import_methods.py on lines 313..320

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

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

            if not header_read:
                if cmp(row_as_list, sample_subspecies_input_schema) != 0:
                    raise Exception(
                        "Mixed field names/order between tables:\nDefined table:{}\nImported table:{}".format(
                            sample_subspecies_input_schema,
Severity: Major
Found in mips/data_manager/import_methods.py and 5 other locations - About 1 hr to fix
mips/data_manager/import_methods.py on lines 66..73
mips/data_manager/import_methods.py on lines 132..139
mips/data_manager/import_methods.py on lines 216..223
mips/data_manager/import_methods.py on lines 266..273
mips/data_manager/import_methods.py on lines 313..320

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

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

            if not header_read:
                if cmp(row_as_list, instance_input_schema) != 0:
                    raise Exception(
                        "Mixed field names/order between tables:\nDefined table:{}\nImported table:{}".format(
                            instance_input_schema,
Severity: Major
Found in mips/data_manager/import_methods.py and 5 other locations - About 1 hr to fix
mips/data_manager/import_methods.py on lines 66..73
mips/data_manager/import_methods.py on lines 132..139
mips/data_manager/import_methods.py on lines 173..180
mips/data_manager/import_methods.py on lines 216..223
mips/data_manager/import_methods.py on lines 266..273

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

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

            if not header_read:
                if cmp(row_as_list, samples_input_schema) != 0:
                    raise Exception(
                        "Mixed field names/order between tables:\nDefined table:{}\nImported table:{}".format(
                            samples_input_schema,
Severity: Major
Found in mips/data_manager/import_methods.py and 5 other locations - About 1 hr to fix
mips/data_manager/import_methods.py on lines 66..73
mips/data_manager/import_methods.py on lines 132..139
mips/data_manager/import_methods.py on lines 173..180
mips/data_manager/import_methods.py on lines 266..273
mips/data_manager/import_methods.py on lines 313..320

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

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

            if not header_read:
                if cmp(row_as_list, mip_table_input_schema) != 0:
                    raise Exception(
                        "Mixed field names/order between tables:\nDefined table:{}\nImported table:{}".format(
                            mip_table_input_schema,
Severity: Major
Found in mips/data_manager/import_methods.py and 5 other locations - About 1 hr to fix
mips/data_manager/import_methods.py on lines 132..139
mips/data_manager/import_methods.py on lines 173..180
mips/data_manager/import_methods.py on lines 216..223
mips/data_manager/import_methods.py on lines 266..273
mips/data_manager/import_methods.py on lines 313..320

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

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

            if not header_read:
                if cmp(row_as_list, subspecies_input_schema) != 0:
                    raise Exception(
                        "Mixed field names/order between tables:\nDefined table:{}\nImported table:{}".format(
                            subspecies_input_schema,
Severity: Major
Found in mips/data_manager/import_methods.py and 5 other locations - About 1 hr to fix
mips/data_manager/import_methods.py on lines 66..73
mips/data_manager/import_methods.py on lines 173..180
mips/data_manager/import_methods.py on lines 216..223
mips/data_manager/import_methods.py on lines 266..273
mips/data_manager/import_methods.py on lines 313..320

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

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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

def func_mips_for_montandoni():

    for montandoni_samples in SampleSubspecies.objects.filter(subspecies_fk="montandoni"):
        for Sample_mip in Samples.objects.filter(sample_fk=montandoni_samples.sample_id):
            if Sample_mip.mip_fk.mip_func_mapping is True:
Severity: Minor
Found in mips/example/examples2.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 samples_for_mips has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def samples_for_mips(lista):

    for ref in lista:
        for mip in Mip.objects.filter(reference_id=ref):
            for sample in Samples.objects.filter(mip_fk=mip):
Severity: Minor
Found in mips/example/examples2.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

Severity
Category
Status
Source
Language