KarrLab/datanator

View on GitHub
datanator/data_source/rna_halflife/order_by_ko.py

Summary

Maintainability
D
2 days
Test Coverage
F
28%

Function fill_helper has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
Open

    def fill_helper(self, doi, field_name, start=0, species=None):
        """Method to fill new collection across different dois.
        
        Args:
            doi (:obj:`str`): DOI of publications.
Severity: Minor
Found in datanator/data_source/rna_halflife/order_by_ko.py - About 4 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

Function __init__ has 12 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def __init__(self, cache_dirname=None, MongoDB=None, src_db='datanator',
Severity: Major
Found in datanator/data_source/rna_halflife/order_by_ko.py - About 1 hr to fix

    Function fill_gr_131_helper has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
    Open

        def fill_gr_131_helper(self, start=0):
            """Fill 10.1101/gr.131037.111
            
            Args:
                start (:obj:`int`, optional): Starting position. Defaults to 0.
    Severity: Minor
    Found in datanator/data_source/rna_halflife/order_by_ko.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 2 locations. Consider refactoring.
    Open

            self.des_client, self.des_db, self.des_collection = mongo_util.MongoUtil(cache_dirname=cache_dirname, MongoDB=MongoDB, db=des_db,
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 1 other location - About 2 hrs to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 35..35

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

    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

            self.src_client, self.src_db, self.src_collection = mongo_util.MongoUtil(cache_dirname=cache_dirname, MongoDB=MongoDB, db=src_db,
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 1 other location - About 2 hrs to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 38..38

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

    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 uniprot_id is not None:
                        self.des_collection.update_one({'uniprot_id': uniprot_id},
                                                        {'$addToSet': {'halflives': subdoc},
                                                         '$set': {'protein_names': protein_names,
                                                                  'ko_number': ko}}, upsert=True, collation=self.collation)                
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 1 other location - About 1 hr to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 108..112

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

    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 uniprot_id is not None:
                            self.des_collection.update_one({'uniprot_id': uniprot_id},
                                                            {'$addToSet': {'halflives': subdoc},
                                                            '$set': {'protein_names': protein_names,
                                                                     'ko_number': ko}}, upsert=True, collation=self.collation)
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 1 other location - About 1 hr to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 98..102

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

    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

        def fill_nar_gkt(self, start=0):
            """Processing 10.1093/nar/gkt1150
            
            Args:
                start (:obj:`int`, optional): Starting document position. Defaults to 0.
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 5 other locations - About 40 mins to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 160..167
    datanator/data_source/rna_halflife/order_by_ko.py on lines 169..176
    datanator/data_source/rna_halflife/order_by_ko.py on lines 187..194
    datanator/data_source/rna_halflife/order_by_ko.py on lines 205..212
    datanator/data_source/rna_halflife/order_by_ko.py on lines 214..221

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

    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

        def fill_s12864(self, start=0):
            """Processing 10.1186/s12864-016-3219-8
            
            Args:
                start (:obj:`int`, optional): Starting document position. Defaults to 0.
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 5 other locations - About 40 mins to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 160..167
    datanator/data_source/rna_halflife/order_by_ko.py on lines 169..176
    datanator/data_source/rna_halflife/order_by_ko.py on lines 178..185
    datanator/data_source/rna_halflife/order_by_ko.py on lines 187..194
    datanator/data_source/rna_halflife/order_by_ko.py on lines 214..221

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

    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

        def fill_mbc(self, start=0):
            """Processing 10.1091/mbc.e11-01-0028
            
            Args:
                start (:obj:`int`, optional): Starting document position. Defaults to 0.
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 5 other locations - About 40 mins to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 169..176
    datanator/data_source/rna_halflife/order_by_ko.py on lines 178..185
    datanator/data_source/rna_halflife/order_by_ko.py on lines 187..194
    datanator/data_source/rna_halflife/order_by_ko.py on lines 205..212
    datanator/data_source/rna_halflife/order_by_ko.py on lines 214..221

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

    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

        def fill_gr_131(self, start=0):
            """Processing 10.1101/gr.131037.111
            
            Args:
                start (:obj:`int`, optional): Starting document position. Defaults to 0.
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 5 other locations - About 40 mins to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 160..167
    datanator/data_source/rna_halflife/order_by_ko.py on lines 169..176
    datanator/data_source/rna_halflife/order_by_ko.py on lines 178..185
    datanator/data_source/rna_halflife/order_by_ko.py on lines 205..212
    datanator/data_source/rna_halflife/order_by_ko.py on lines 214..221

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

    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

        def fill_nar_gks(self, start=0):
            """Processing 10.1093/nar/gks1019
            
            Args:
                start (:obj:`int`, optional): Starting document position. Defaults to 0.
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 5 other locations - About 40 mins to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 160..167
    datanator/data_source/rna_halflife/order_by_ko.py on lines 178..185
    datanator/data_source/rna_halflife/order_by_ko.py on lines 187..194
    datanator/data_source/rna_halflife/order_by_ko.py on lines 205..212
    datanator/data_source/rna_halflife/order_by_ko.py on lines 214..221

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

    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

        def fill_journal_pone(self, start=0):
            """Processing 10.1371/journal.pone.0059059
            
            Args:
                start (:obj:`int`, optional): Starting document position. Defaults to 0.
    Severity: Major
    Found in datanator/data_source/rna_halflife/order_by_ko.py and 5 other locations - About 40 mins to fix
    datanator/data_source/rna_halflife/order_by_ko.py on lines 160..167
    datanator/data_source/rna_halflife/order_by_ko.py on lines 169..176
    datanator/data_source/rna_halflife/order_by_ko.py on lines 178..185
    datanator/data_source/rna_halflife/order_by_ko.py on lines 187..194
    datanator/data_source/rna_halflife/order_by_ko.py on lines 205..212

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

    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