KarrLab/datanator_query_python

View on GitHub
datanator_query_python/util/chem_util.py

Summary

Maintainability
C
1 day
Test Coverage
C
77%

Function inchi_to_inchikey has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
Open

    def inchi_to_inchikey(self, szINCHISource):
        '''
            fork from git@github.com:mnowotka/chembl_ikey.git
        '''
        flagstd = 'S'
Severity: Minor
Found in datanator_query_python/util/chem_util.py - About 6 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 inchi_to_inchikey has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def inchi_to_inchikey(self, szINCHISource):
        '''
            fork from git@github.com:mnowotka/chembl_ikey.git
        '''
        flagstd = 'S'
Severity: Minor
Found in datanator_query_python/util/chem_util.py - About 1 hr 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 '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 '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

                There are no issues that match your filters.

                Category
                Status