endremborza/colassigner

View on GitHub

Showing 6 of 6 total issues

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

    def _add_expr(self, elem: ast.expr):
        sub = ()
        if isinstance(elem, (ast.List, ast.Tuple)):
            sub = elem.elts
        if isinstance(elem, ast.Lambda):
Severity: Minor
Found in colassigner/dag_from_ast.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 _resolve has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def _resolve(self, source, resolved=()):
        for sub in self._resolvers.get(source, []):
            if sub in [source, *resolved]:
                continue
            resolved = (sub, *resolved)
Severity: Minor
Found in colassigner/dag_from_ast.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 measure_effect has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

def measure_effect(assigner, base_df, cause_col, effect_col, treat_rate=0.2, seed=742):
Severity: Minor
Found in colassigner/experiment.py - About 45 mins to fix

    Function experiment has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def experiment(assigner_inst, base_df, col_to_treat, treat_rate=0.2, seed=742):
    Severity: Minor
    Found in colassigner/experiment.py - About 35 mins to fix

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

          def _iter_mc(self, md: MethodDef):
              for source in md.uses:
                  if source.startswith("_"):
                      for sub in self._resolve(source):
                          yield (sub, md.name)
      Severity: Minor
      Found in colassigner/dag_from_ast.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 _reducer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def _reducer(self, red_out: tuple[pd.DataFrame, tuple], attid: str):
              if attid.startswith("_"):
                  return red_out
              df, prefixes = red_out
              att = getattr(self, attid)
      Severity: Minor
      Found in colassigner/core.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