HazyResearch/numbskull

View on GitHub

Showing 154 of 497 total issues

Avoid too many return statements within this function.
Open

            return -1 if l2_index != 1 else 0
Severity: Major
Found in numbskull/inference.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

            return 0 if l1_index == abstain or l2_index == abstain else -1
    Severity: Major
    Found in numbskull/inference.py - About 30 mins to fix

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

          def __init__(self, **kwargs):
              """TODO.
      
              Parameters
              ----------
      Severity: Minor
      Found in numbskull/numbskull.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 compute_map_master has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def compute_map_master(vid, var_pt):
          l = 0
          for i in range(len(var_pt)):
              if var_pt[i] == 66:  # 66 = "B"
                  l += 1
      Severity: Minor
      Found in salt/src/messages.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 decrease_vid has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def decrease_vid(fmap, vid, amount, begin, end):
          if begin < end:
              for i in range(len(fmap)):
                  if vid[begin] <= fmap[i]["vid"] <= vid[end - 1]:
                      fmap[i]["vid"] -= amount
      Severity: Minor
      Found in salt/src/messages.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 compute_map_minion has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def compute_map_minion(vid, var_pt):
          l = 0
          for i in range(len(var_pt)):
              if var_pt[i] == 68:  # 68 = "D"
                  l += 1
      Severity: Minor
      Found in salt/src/messages.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 main has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def main(argv=None):
          """TODO."""
          if argv is None:
              argv = sys.argv[1:]
      
      
      Severity: Minor
      Found in numbskull/distributed.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 generate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def generate(directory, degree, copies):
          print("Generating " + directory + "...")
          sys.stdout.flush()
      
          try:
      Severity: Minor
      Found in experiments/intro/generate.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 handle_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def handle_message(self, stream, header, payload):
              """Handle incoming messages from underylying tcp streams."""
              if self.fire_local_event(payload):
                  try:
                      stream.write(salt.transport.frame.frame_msg('OK',
      Severity: Minor
      Found in salt/src/numbskull_minion_server.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 load_factors has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def load_factors(data, nfactors, factors, fmap, domain_mask, variable, vmap):
          """TODO."""
          index = 0
          fmap_idx = 0
          k = 0  # somehow numba 0.28 would raise LowerError without this line
      Severity: Minor
      Found in numbskull/dataloading.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 read_views has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def read_views(cur, views, sql_filter="True"):
          """TODO."""
          data = []
          op_template = "SELECT * FROM {table_name} " \
                        "WHERE {filter}"
      Severity: Minor
      Found in salt/src/messages.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_factors_helper has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_factors_helper(row, fid, ff, factor, factor_pt, factor_ufo, fmap,
                             factor_index, fmap_index):
          """TODO."""
          for i in row:
              fid[factor_index] = i[-1]
      Severity: Minor
      Found in salt/src/messages.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 load_domains has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

      def load_domains(data, domain_mask, vmap, variables):
          """TODO."""
          index = 0
          while index < data.size:
              buf = data[index: index + 8]
      Severity: Minor
      Found in numbskull/dataloading.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 run_ddlog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def run_ddlog(self):
              # semantic partitioning
              if self.partition_method == 'sp':
                  cmd = ["ddlog", "semantic-partition", "app.ddlog",
                         self.partition_scheme,
      Severity: Minor
      Found in salt/src/numbskull_master.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