KarrLab/datanator_query_python

View on GitHub

Showing 101 of 190 total issues

Function get_info_by_text_abundances has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_info_by_text_abundances(self, name):
        '''
            Get proteins whose name or kegg name contains string 'name'.

            Args:
Severity: Minor
Found in datanator_query_python/query/query_protein.py - About 35 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 get_similar_concentrations has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_similar_concentrations(self, metabolite, threshold=0.6):
        """Get metabolite's similar compounds' concentrations above
        threshold tanimoto value.

        Args:
Severity: Minor
Found in datanator_query_python/query/query_metabolite_concentrations.py - About 35 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 get_kinlaw_by_environment has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def get_kinlaw_by_environment(self, taxon=None, taxon_wildtype=None, ph_range=None, temp_range=None,
                          name_space=None, observed_type=None, projection={'_id': 0}):
        """get kinlaw info based on experimental conditions
        
        Args:
Severity: Minor
Found in datanator_query_python/query/query_sabiork.py - About 35 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 update_observation has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def update_observation(self, 
                           obj,
                           source,
                           db="test",
                           op="update",
Severity: Minor
Found in datanator_query_python/util/mongo_util.py - About 35 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

Avoid too many return statements within this function.
Open

        return {str(org1): distance1, str(org2): distance2, str(org1)+'_canon_ancestors':canon_anc_1,
Severity: Major
Found in datanator_query_python/query/query_taxon_tree.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return "%s-%s%s%s-%s" % (major, minor, flag, flagver, flagproto)
    Severity: Major
    Found in datanator_query_python/util/chem_util.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

              return {str(org1): distance1, str(org2): distance2, str(org1)+'_canon_ancestors':canon_anc_1,
      Severity: Major
      Found in datanator_query_python/query/query_taxon_tree.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                    return 'Invalid inchi string'
        Severity: Major
        Found in datanator_query_python/util/chem_util.py - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

                          return 'Invalid inchi string'
          Severity: Major
          Found in datanator_query_python/util/chem_util.py - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                    return result
            Severity: Major
            Found in datanator_query_python/query/query_protein.py - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                          return 'Invalid inchi string'
              Severity: Major
              Found in datanator_query_python/util/chem_util.py - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                                    return None
                Severity: Major
                Found in datanator_query_python/util/chem_util.py - About 30 mins to fix

                  Avoid too many return statements within this function.
                  Open

                              return 'Invalid inchi string'
                  Severity: Major
                  Found in datanator_query_python/util/chem_util.py - About 30 mins to fix

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

                        def get_canon_rank_distance(self, _id, front_end=False):
                            '''Given the ncbi_id, return canonically-ranked ancestors
                                along the lineage and their non-canonical distances
                    
                            Args:
                    Severity: Minor
                    Found in datanator_query_python/query/query_taxon_tree.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 get_subunit_by_id has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_subunit_by_id(self, _id):
                            """Get protein subunit information by kinlaw_id.
                            
                            Args:
                                _id (:obj:`int`): kinlaw_id.
                    Severity: Minor
                    Found in datanator_query_python/query/query_sabiork.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 get_kinlawid_by_rxn has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_kinlawid_by_rxn(self, substrates, products, dof=0):
                            ''' Find the kinlaw_id defined in sabio_rk using 
                                rxn participants' inchikey
                    
                                Args:
                    Severity: Minor
                    Found in datanator_query_python/query/query_sabiork_old.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 each_under_category has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def each_under_category(self, src_tax_ids, target_tax_id):
                            """Given a list of source organism IDs, check if each ID
                            is the child of target organism.
                            
                            Args:
                    Severity: Minor
                    Found in datanator_query_python/query/query_taxon_tree.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 get_single_index_count has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_single_index_count(self, q, index, num, 
                                                   excludes=[], includes=[],
                                                   **kwargs):
                            """Get single index up to num hits
                            
                    Severity: Minor
                    Found in datanator_query_python/query/full_text_search.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 get_kinlaw_by_environment has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def get_kinlaw_by_environment(self, taxon=None, taxon_wildtype=None, ph_range=None, temp_range=None,
                                              name_space=None, param_type=None, projection={'_id': 0}):
                            """get kinlaw info based on experimental conditions
                            
                            Args:
                    Severity: Minor
                    Found in datanator_query_python/query/query_sabiork_old.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 build_taxon_object has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def build_taxon_object(self, _id, _format="tax_id"):
                            """Build taxon object from taxon_id.
                            (https://github.com/KarrLab/datanator_pattern_design/blob/master/components/taxon.json)
                    
                            Args:
                    Severity: Minor
                    Found in datanator_query_python/util/mongo_util.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