HazyResearch/numbskull

View on GitHub

Showing 154 of 497 total issues

Avoid deeply nested control flow statements.
Open

                    if is_pf:
                        var = pf_ufo_var_list[local_vid - pf_var_begin]
                    else:
                        var = local_vid
            # if var == -1:
Severity: Major
Found in salt/src/messages.py - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

                        if is_ufo:
                            assert(var == -1)  # This must be the first seen
                            is_pf = (var_pt[local_vid] == 80)  # check if this is a partial factor
                            if is_pf:
                                var = pf_ufo_var_list[local_vid - pf_var_begin]
    Severity: Major
    Found in salt/src/messages.py - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

                          if is_pf:
                              var = pf_ufo_var_list[local_vid - pf_var_begin]
                          else:
                              var = local_vid
                  # if var == -1:
      Severity: Major
      Found in salt/src/messages.py - About 45 mins to fix

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

            def burnIn(self, epochs, sample_evidence, diagnostics=False,
        Severity: Minor
        Found in numbskull/factorgraph.py - About 35 mins to fix

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

          def send_array(socket, A, flags=0, copy=True, track=False):
          Severity: Minor
          Found in numbskull/distributed.py - About 35 mins to fix

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

            def generate(directory, propositions, voters_per_proposition, copies,
            Severity: Minor
            Found in experiments/tradeoff/generate.py - About 35 mins to fix

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

                      def __init__(self, socket_queue, message_handler, logger, *args,
              Severity: Minor
              Found in salt/src/numbskull_minion_server.py - About 35 mins to fix

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

                    def __init__(self,
                Severity: Minor
                Found in salt/src/numbskull_minion_server.py - About 35 mins to fix

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

                  def decrease_vid(fmap, vid, amount, begin, end):
                  Severity: Minor
                  Found in salt/src/messages.py - About 35 mins to fix

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

                    def apply_ufo_values(factor, fmap, var_value, ufo_map, ufo_values):
                    Severity: Minor
                    Found in salt/src/messages.py - About 35 mins to fix

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

                      def run_pool(threadpool, threads, func, args):
                          """TODO."""
                          if threads == 1:
                              func(0, *args)
                          else:
                      Severity: Minor
                      Found in numbskull/factorgraph.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_variables has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

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

                          def prep_minions_numbskull(self):
                              """TODO."""
                              # send args and initialize numbskull at minion
                              data = {'argv': self.argv}
                              newEvent = self.local_client.cmd(self.minions,
                      Severity: Minor
                      Found in salt/src/numbskull_master.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 close has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def close(self):
                              """TODO."""
                              if self._socket is not None:
                                  try:
                                      self._socket.shutdown(socket.SHUT_RDWR)
                      Severity: Minor
                      Found in salt/src/numbskull_minion_server.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 compute_ufo_values has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def compute_ufo_values(factor, fmap, var_value, variable, var_ufo, ufo_send, ufo_start, ufo_map, ufo):
                          var_copy = 0
                          ufo_index = 0
                      
                          for i in range(len(ufo)):
                      Severity: Minor
                      Found in salt/src/messages.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_weights has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get_weights(cur, views, sql_filter="True"):
                          """TODO."""
                          op_template = "SELECT {cmd} FROM {table_name} " \
                                        "WHERE {filter}"
                      
                      
                      Severity: Minor
                      Found in salt/src/messages.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 -1
                      Severity: Major
                      Found in numbskull/inference.py - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                                        return 0
                        Severity: Major
                        Found in numbskull/inference.py - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                          return 1
                          Severity: Major
                          Found in numbskull/inference.py - About 30 mins to fix

                            Avoid too many return statements within this function.
                            Open

                                            return -1
                            Severity: Major
                            Found in numbskull/inference.py - About 30 mins to fix
                              Severity
                              Category
                              Status
                              Source
                              Language