dmyersturnbull/mandos

View on GitHub

Showing 151 of 151 total issues

Function calc_phi has 8 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def calc_phi(
Severity: Major
Found in mandos/entry/calc_commands.py - About 1 hr to fix

    Function init_db has 8 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def init_db(
    Severity: Major
    Found in mandos/entry/misc_commands.py - About 1 hr to fix

      Function calc_tau has 8 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def calc_tau(
      Severity: Major
      Found in mandos/entry/calc_commands.py - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                if "Number" in dot and len(["Number"]) == 1:
                    value = dot["Number"][0]
                elif "Number" in dot and len(["Number"]) > 1:
                    value = ", ".join([str(s) for s in dot["Number"]])
                elif (
        Severity: Major
        Found in mandos/model/apis/pubchem_support/pubchem_data.py - About 1 hr to fix

          Function _go_inside has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def _go_inside(self, key: Union[int, str]) -> JsonNavigator:
                  new = []
                  for z in self.contents:
                      if key in z:
                          # nav = z.get_as("_nav", list, [])
          Severity: Minor
          Found in mandos/model/apis/pubchem_support/_nav.py - About 55 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 find has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def find(self, inchikey: str) -> Sequence[T]:
                  data = self.api.fetch_data(inchikey)
                  results = []
                  for dd in data.biomolecular_interactions_and_pathways.drugbank_interactions:
                      if dd.target_type in self.target_types:
          Severity: Minor
          Found in mandos/search/pubchem/drugbank_interaction_search.py - About 55 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 find has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def find(self, inchikey: str) -> Sequence[AcuteEffectHit]:
                  data = self.api.fetch_data(inchikey)
                  results = []
                  for dd in data.toxicity.acute_effects:
                      for effect in dd.effects:
          Severity: Minor
          Found in mandos/search/pubchem/acute_effects_search.py - About 55 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 calc_one has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def calc_one(self, key: str, hits: Sequence[AbstractHit]) -> SimilarityDfShortForm:
                  ik2hits = Au.hit_multidict(hits, "origin_inchikey")
                  logger.info(f"Calculating J on {key} for {len(ik2hits):,} compounds and {len(hits):,} hits")
                  data = defaultdict(dict)
                  inf = _Inf(n=int(len(ik2hits) * (len(ik2hits) - 1) / 2))
          Severity: Minor
          Found in mandos/analysis/distances.py - About 55 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 calc_projection has 7 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def calc_projection(
          Severity: Major
          Found in mandos/entry/calc_commands.py - About 50 mins to fix

            Function calc_ecfp has 7 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def calc_ecfp(
            Severity: Major
            Found in mandos/entry/calc_commands.py - About 50 mins to fix

              Function set_default has 7 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def set_default(
              Severity: Major
              Found in mandos/entry/api_singletons.py - About 50 mins to fix

                Function search has 7 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                    def search(
                Severity: Major
                Found in mandos/entry/misc_commands.py - About 50 mins to fix

                  Function set has 7 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def set(
                  Severity: Major
                  Found in mandos/entry/api_singletons.py - About 50 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if xref["xref_src_db"] == f"Go{self.go_type.name.capitalize()}":
                                                terms.add((xref["xref_id"], xref["xref_name"]))
                            hits = []
                    Severity: Major
                    Found in mandos/search/chembl/go_search.py - About 45 mins to fix

                      Function __init__ has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(self, path: Path, compounds: Sequence[str], *, restart: bool, proceed: bool):
                              # TODO: This class is pretty bad
                              self._path = path
                              exists = self._path.exists() and self._meta_path.exists()
                              if exists:
                      Severity: Minor
                      Found in mandos/model/search_caches.py - About 45 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 _if_match has 6 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                          def _if_match(
                      Severity: Minor
                      Found in mandos/search/pubchem/ctd_gene_search.py - About 45 mins to fix

                        Function create has 6 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                            def create(
                        Severity: Minor
                        Found in mandos/analysis/distances.py - About 45 mins to fix

                          Function _get_metadata has 6 arguments (exceeds 4 allowed). Consider refactoring.
                          Open

                              def _get_metadata(
                          Severity: Minor
                          Found in mandos/model/apis/querying_pubchem_api.py - About 45 mins to fix

                            Function adjust_filename has 6 arguments (exceeds 4 allowed). Consider refactoring.
                            Open

                                def adjust_filename(
                            Severity: Minor
                            Found in mandos/entry/utils/_arg_utils.py - About 45 mins to fix

                              Function get_kwargs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                              Open

                                  def get_kwargs(
                                      self, n_rows: int, n_categories: int, more: Mapping[str, Any]
                                  ) -> Mapping[str, Any]:
                                      kwargs = dict(dropna=False)
                                      kwargs.update(**more)
                              Severity: Minor
                              Found in mandos/analysis/plots.py - About 45 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