HazyResearch/numbskull

View on GitHub

Showing 154 of 497 total issues

Function get_fg_data has 69 lines of code (exceeds 25 allowed). Consider refactoring.
Open

def get_fg_data(cur, filt, ismaster):
    """TODO."""
    print("***GET_FG_DATA***")

    # Get names of views
Severity: Major
Found in salt/src/messages.py - About 2 hrs to fix

    Function loadFGFromFile has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
    Open

        def loadFGFromFile(self, directory=None, metafile=None, weightfile=None,
                           variablefile=None, factorfile=None, domainfile=None,
                           var_copies=1, weight_copies=1):
            """TODO."""
            # init necessary input arguments
    Severity: Minor
    Found in numbskull/numbskull.py - About 2 hrs 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 learnthread has 20 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def learnthread(shardID, nshards, step, regularization, reg_param, truncation,
    Severity: Major
    Found in numbskull/learning.py - About 2 hrs to fix

      Function sample_and_sgd has 19 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def sample_and_sgd(var_samp, step, regularization, reg_param, truncation,
      Severity: Major
      Found in numbskull/learning.py - About 2 hrs to fix

        Function gibbsthread has 17 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def gibbsthread(shardID, nshards, var_copy, weight_copy, weight, variable,
        Severity: Major
        Found in numbskull/inference.py - About 2 hrs to fix

          Function client has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def client(argv=None):
              """TODO."""
              parser = argparse.ArgumentParser(
                  description="Run Gibbs worker",
                  epilog="")
          Severity: Minor
          Found in numbskull/distributed.py - About 2 hrs 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_factor_views has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

          def read_factor_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 2 hrs 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_connected_components has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

          def find_connected_components(conn, cur):
              """TODO."""
              # Open a cursor to perform database operations
              (factor_view, variable_view, weight_view) = get_views(cur)
              (factor, factor_pt, factor_ufo, fmap, edges) = \
          Severity: Minor
          Found in salt/src/messages.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 factor has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          def factor(f, args):
              """THIS IS A DOCSTRING."""
              if f == FUNC_IMPLY_NATURAL:
                  # TODO
                  pass
          Severity: Minor
          Found in loadfg.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 gibbsthread has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

          def gibbsthread(shardID, nshards, var_copy, weight_copy, weight, variable,
                          factor, fmap, vmap, factor_index, Z, cstart,
                          count, var_value, weight_value, sample_evidence, burnin):
              """TODO."""
              # Indentify start and end variable
          Severity: Minor
          Found in numbskull/inference.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 set_ufo has 13 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def set_ufo(factor, factor_pt, factor_ufo, fmap, vid, variable, var_pt, var_ufo, ufo_recv, n_factors, n_fmap, n_var, vid_max):
          Severity: Major
          Found in salt/src/messages.py - About 1 hr to fix

            Function set_pf has 13 arguments (exceeds 4 allowed). Consider refactoring.
            Open

            def set_pf(factor, factor_pt, factor_ufo, fmap, fid, vid, variable, var_pt, var_ufo, pf_var_begin, vid_max, ismaster, pf_ufo_var_list):
            Severity: Major
            Found in salt/src/messages.py - About 1 hr to fix

              Function learn has 12 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def learn(self, burnin_epochs, epochs, stepsize, decay, regularization,
              Severity: Major
              Found in numbskull/factorgraph.py - About 1 hr to fix

                Function potential has 12 arguments (exceeds 4 allowed). Consider refactoring.
                Open

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

                  Function draw_sample has 12 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                  def draw_sample(var_samp, var_copy, weight_copy, weight, variable, factor,
                  Severity: Major
                  Found in numbskull/inference.py - About 1 hr to fix

                    Function loadFGFromFile has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def loadFGFromFile(self, directory=None, metafile=None, weightfile=None,
                                           variablefile=None, factorfile=None, domainfile=None,
                                           var_copies=1, weight_copies=1):
                            """TODO."""
                            # init necessary input arguments
                    Severity: Minor
                    Found in numbskull/numbskull.py - About 1 hr to fix

                      Function get_views has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def get_views(cur):
                          """TODO."""
                          cur.execute("SELECT table_name "
                                      "FROM INFORMATION_SCHEMA.views "
                                      "WHERE table_name LIKE '%_sharding' "
                      Severity: Minor
                      Found in salt/src/messages.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 create_fg has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def create_fg(prior, accuracy, abstain, copies):
                          """
                          This creates copies of the following factor graph.
                                       istrue (weight = prior)
                                                    |
                      Severity: Minor
                      Found in test_lf_learning.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 compute_ufo_map has 11 arguments (exceeds 4 allowed). Consider refactoring.
                      Open

                      def compute_ufo_map(factor, factor_pt, factor_ufo, fmap, vid, variable, var_pt, var_ufo, ufo_send, pf_ufo_var_list, pf_var_begin):
                      Severity: Major
                      Found in salt/src/messages.py - About 1 hr to fix

                        Function compute_skipped_factors has 11 arguments (exceeds 4 allowed). Consider refactoring.
                        Open

                        def compute_skipped_factors(factor, factor_pt, factor_ufo, fmap, fid, vid,
                        Severity: Major
                        Found in salt/src/messages.py - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language