HazyResearch/numbskull

View on GitHub

Showing 154 of 497 total issues

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

def eval_factor(factor_id, var_samp, value, var_copy, variable, factor, fmap,
Severity: Major
Found in numbskull/inference.py - About 1 hr to fix

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

            def run(self):
                """Start the load balancer."""
                self._socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
                self._socket.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
                _set_tcp_keepalive(self._socket, self.opts)
    Severity: Minor
    Found in salt/src/numbskull_minion_server.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 learn has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

        def learn(self, burnin_epochs, epochs, stepsize, decay, regularization,
                  reg_param, truncation, diagnostics=False, verbose=False,
                  learn_non_evidence=False, var_copy=0, weight_copy=0):
            """TODO."""
            # Burn-in
    Severity: Minor
    Found in numbskull/factorgraph.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 compute_var_map has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def compute_var_map(variables, factors, fmap, vmap, factor_index, domain_mask,
    Severity: Major
    Found in numbskull/dataloading.py - About 50 mins to fix

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

          def __init__(self, application_dir, machines, 
      Severity: Major
      Found in salt/src/numbskull_master.py - About 50 mins to fix

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

        def load_factors(data, nfactors, factors, fmap, domain_mask, variable, vmap):
        Severity: Major
        Found in numbskull/dataloading.py - About 50 mins to fix

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

              def handle_stream(self, stream, address):
                  """Handle incoming streams and add messages to the incoming queue."""
                  self.log.debug('InfLearn client {0} connected'.format(address))
                  self.clients.append((stream, address))
                  unpacker = msgpack.Unpacker()
          Severity: Minor
          Found in salt/src/numbskull_minion_server.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 inference has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def inference(self, burnin_epochs, epochs, sample_evidence=False,
          Severity: Minor
          Found in numbskull/factorgraph.py - About 45 mins to fix

            Avoid deeply nested control flow statements.
            Open

                                if tcp_keepalive_idle > 0:
                                    sock.setsockopt(
                                        socket.SOL_TCP, socket.TCP_KEEPIDLE,
                                        int(tcp_keepalive_idle))
                            if hasattr(socket, 'TCP_KEEPCNT'):
            Severity: Major
            Found in salt/src/numbskull_minion_server.py - About 45 mins to fix

              Avoid deeply nested control flow statements.
              Open

                                  if tcp_keepalive_intvl > 0:
                                      sock.setsockopt(
                                          socket.SOL_TCP, socket.TCP_KEEPINTVL,
                                          int(tcp_keepalive_intvl))
                          if hasattr(socket, 'SIO_KEEPALIVE_VALS'):
              Severity: Major
              Found in salt/src/numbskull_minion_server.py - About 45 mins to fix

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

                    def __bind(self):
                        """TODO."""
                        if self.log_queue is not None:
                            salt.log.setup.set_multiprocessing_logging_queue(self.log_queue)
                        salt.log.setup.setup_multiprocessing_logging(self.log_queue)
                Severity: Minor
                Found in salt/src/numbskull_minion_server.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 compute_pf_values has 6 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                def compute_pf_values(factor, fmap, var_value, variable, pf_list, pf):
                Severity: Minor
                Found in salt/src/messages.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                      if tcp_keepalive_cnt > 0:
                                          sock.setsockopt(
                                              socket.SOL_TCP, socket.TCP_KEEPCNT,
                                              int(tcp_keepalive_cnt))
                                  if hasattr(socket, 'TCP_KEEPINTVL'):
                  Severity: Major
                  Found in salt/src/numbskull_minion_server.py - About 45 mins to fix

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

                    def apply_pf_values(factor, fmap, var_value, variable, pf_list, pf_values):
                    Severity: Minor
                    Found in salt/src/messages.py - About 45 mins to fix

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

                          def dump_probabilities(self, fout, epochs):
                              """Dump <vid, value, prob> text file in DW format."""
                              epochs = epochs or 1
                              with open(fout, 'w') as out:
                                  for i, v in enumerate(self.variable):
                      Severity: Minor
                      Found in numbskull/factorgraph.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

                      Avoid deeply nested control flow statements.
                      Open

                                          if tcp_keepalive_intvl <= 0:
                                              tcp_keepalive_intvl = 1
                                          # The values expected are in milliseconds, so multiply by
                                          # 1000.
                                          sock.ioctl(socket.SIO_KEEPALIVE_VALS, (
                      Severity: Major
                      Found in salt/src/numbskull_minion_server.py - About 45 mins to fix

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

                        def skip(app, what, name, obj, skip, options):
                        Severity: Minor
                        Found in docs/source/conf.py - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                              if tcp_keepalive_idle <= 0:
                                                  tcp_keepalive_idle = 7200
                                              if tcp_keepalive_intvl <= 0:
                          Severity: Major
                          Found in salt/src/numbskull_minion_server.py - About 45 mins to fix

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

                            def get_variables_helper(row, vid, variable, var_pt, var_ufo, index):
                            Severity: Minor
                            Found in salt/src/messages.py - About 45 mins to fix

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

                                  def inference(self, burnin_epochs, epochs, sample_evidence=False,
                                                diagnostics=False, var_copy=0, weight_copy=0):
                                      """TODO."""
                                      # Burn-in
                                      if burnin_epochs > 0:
                              Severity: Minor
                              Found in numbskull/factorgraph.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