HazyResearch/numbskull

View on GitHub
numbskull/inference.py

Summary

Maintainability
F
3 wks
Test Coverage

Function eval_factor has a Cognitive Complexity of 224 (exceeds 5 allowed). Consider refactoring.
Open

def eval_factor(factor_id, var_samp, value, var_copy, variable, factor, fmap,
                var_value):
    """TODO."""
    ####################
    # BINARY VARIABLES #
Severity: Minor
Found in numbskull/inference.py - About 4 days 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

Cyclomatic complexity is too high in function eval_factor. (121)
Open

@jit(nopython=True, cache=True, nogil=True)
def eval_factor(factor_id, var_samp, value, var_copy, variable, factor, fmap,
                var_value):
    """TODO."""
    ####################
Severity: Minor
Found in numbskull/inference.py by radon

Cyclomatic Complexity

Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

Construct Effect on CC Reasoning
if +1 An if statement is a single decision.
elif +1 The elif statement adds another decision.
else +0 The else statement does not cause a new decision. The decision is at the if.
for +1 There is a decision at the start of the loop.
while +1 There is a decision at the while statement.
except +1 Each except branch adds a new conditional path of execution.
finally +0 The finally block is unconditionally executed.
with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
assert +1 The assert statement internally roughly equals a conditional statement.
Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

Source: http://radon.readthedocs.org/en/latest/intro.html

File inference.py has 311 lines of code (exceeds 250 allowed). Consider refactoring.
Open

"""TODO."""

from __future__ import print_function, absolute_import
import numba
from numba import jit
Severity: Minor
Found in numbskull/inference.py - About 3 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

      Cyclomatic complexity is too high in function gibbsthread. (7)
      Open

      @jit(nopython=True, cache=True, nogil=True)
      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."""
      Severity: Minor
      Found in numbskull/inference.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      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 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 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 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

            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 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

                    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 math.log(res)  # TODO: use log2?
                      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 0
                          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

                                  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

                                      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

                                          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

                                                Avoid too many return statements within this function.
                                                Open

                                                        return res
                                                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 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 if y_index == 1 else -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

                                                            Avoid too many return statements within this function.
                                                            Open

                                                                    return 0 if l_index == abstain else 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

                                                                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 value if fmap[ftv_start + v - 1]["vid"] == var_samp else \
                                                                  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

                                                                        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

                                                                              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

                                                                                  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 0
                                                                                      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 0
                                                                                          Severity: Major
                                                                                          Found in numbskull/inference.py - About 30 mins to fix

                                                                                            Avoid too many return statements within this function.
                                                                                            Open

                                                                                                    return 1 if l1_index == l2_index else 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

                                                                                                  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 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
                                                                                                      Severity: Major
                                                                                                      Found in numbskull/inference.py - About 30 mins to fix

                                                                                                        TODO found
                                                                                                        Open

                                                                                                            """TODO."""
                                                                                                        Severity: Minor
                                                                                                        Found in numbskull/inference.py by fixme

                                                                                                        TODO found
                                                                                                        Open

                                                                                                            """TODO."""
                                                                                                        Severity: Minor
                                                                                                        Found in numbskull/inference.py by fixme

                                                                                                        TODO found
                                                                                                        Open

                                                                                                                return math.log(res)  # TODO: use log2?
                                                                                                        Severity: Minor
                                                                                                        Found in numbskull/inference.py by fixme

                                                                                                        TODO found
                                                                                                        Open

                                                                                                            """TODO."""
                                                                                                        Severity: Minor
                                                                                                        Found in numbskull/inference.py by fixme

                                                                                                        TODO found
                                                                                                        Open

                                                                                                            """TODO."""
                                                                                                        Severity: Minor
                                                                                                        Found in numbskull/inference.py by fixme

                                                                                                        TODO found
                                                                                                        Open

                                                                                                        """TODO."""
                                                                                                        Severity: Minor
                                                                                                        Found in numbskull/inference.py by fixme

                                                                                                        TODO found
                                                                                                        Open

                                                                                                            # TODO: give option do not store result, or just store tally
                                                                                                        Severity: Minor
                                                                                                        Found in numbskull/inference.py by fixme

                                                                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                            elif factor[factor_id]["factorFunction"] == FUNC_DP_GEN_DEP_FIXING:
                                                                                                                # NB: this doesn't make sense for categoricals
                                                                                                                y_index = value if fmap[ftv_start]["vid"] == var_samp else \
                                                                                                                    var_value[var_copy][fmap[ftv_start]["vid"]]
                                                                                                                l1_index = value if fmap[ftv_start + 1]["vid"] == var_samp else \
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 1 other location - About 3 days to fix
                                                                                                        numbskull/inference.py on lines 364..380

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 318.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                            elif factor[factor_id]["factorFunction"] == FUNC_DP_GEN_DEP_REINFORCING:
                                                                                                                # NB: this doesn't make sense for categoricals
                                                                                                                y_index = value if fmap[ftv_start]["vid"] == var_samp else \
                                                                                                                    var_value[var_copy][fmap[ftv_start]["vid"]]
                                                                                                                l1_index = value if fmap[ftv_start + 1]["vid"] == var_samp else \
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 1 other location - About 3 days to fix
                                                                                                        numbskull/inference.py on lines 347..363

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 318.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                            elif factor[factor_id]["factorFunction"] == FUNC_IMPLY_NATURAL_CAT:
                                                                                                                for l in range(ftv_start, ftv_end - 1):
                                                                                                                    v = value if (fmap[l]["vid"] == var_samp) \
                                                                                                                        else var_value[var_copy][fmap[l]["vid"]]
                                                                                                                    if v != fmap[l]["dense_equal_to"]:
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 1 other location - About 1 day to fix
                                                                                                        numbskull/inference.py on lines 281..295

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 176.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                            elif factor[factor_id]["factorFunction"] == FUNC_IMPLY_MLN_CAT:
                                                                                                                for l in range(ftv_start, ftv_end - 1):
                                                                                                                    v = value if (fmap[l]["vid"] == var_samp) \
                                                                                                                        else var_value[var_copy][fmap[l]["vid"]]
                                                                                                                    if v != fmap[l]["dense_equal_to"]:
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 1 other location - About 1 day to fix
                                                                                                        numbskull/inference.py on lines 266..280

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 176.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                                for l in range(ftv_start, ftv_end - 1):
                                                                                                                    v = value if (fmap[l]["vid"] == var_samp) \
                                                                                                                        else var_value[var_copy][fmap[l]["vid"]]
                                                                                                                    if v == head:
                                                                                                                        res += 1
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 1 other location - About 5 hrs to fix
                                                                                                        numbskull/inference.py on lines 205..209

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 87.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                                for l in range(ftv_start, ftv_end - 1):
                                                                                                                    v = value if (fmap[l]["vid"] == var_samp) \
                                                                                                                        else var_value[var_copy][fmap[l]["vid"]]
                                                                                                                    if v == head:
                                                                                                                        res += 1
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 1 other location - About 5 hrs to fix
                                                                                                        numbskull/inference.py on lines 216..220

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 87.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                            elif factor[factor_id]["factorFunction"] == FUNC_OR:
                                                                                                                for l in range(ftv_start, ftv_end):
                                                                                                                    v = value if (fmap[l]["vid"] == var_samp) else \
                                                                                                                        var_value[var_copy][fmap[l]["vid"]]
                                                                                                                    if v == 1:
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 1 other location - About 4 hrs to fix
                                                                                                        numbskull/inference.py on lines 193..200

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 81.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                            elif factor[factor_id]["factorFunction"] == FUNC_AND \
                                                                                                                    or factor[factor_id]["factorFunction"] == FUNC_ISTRUE:
                                                                                                                for l in range(ftv_start, ftv_end):
                                                                                                                    v = value if (fmap[l]["vid"] == var_samp) \
                                                                                                                        else var_value[var_copy][fmap[l]["vid"]]
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 1 other location - About 4 hrs to fix
                                                                                                        numbskull/inference.py on lines 177..183

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 81.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Identical blocks of code found in 3 locations. Consider refactoring.
                                                                                                        Open

                                                                                                                head = value if (fmap[ftv_end - 1]["vid"] == var_samp) \
                                                                                                                    else var_value[var_copy][fmap[ftv_end - 1]["vid"]]
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 2 other locations - About 3 hrs to fix
                                                                                                        numbskull/inference.py on lines 203..204
                                                                                                        numbskull/inference.py on lines 224..225

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 65.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Identical blocks of code found in 3 locations. Consider refactoring.
                                                                                                        Open

                                                                                                                head = value if (fmap[ftv_end - 1]["vid"] == var_samp) \
                                                                                                                    else var_value[var_copy][fmap[ftv_end - 1]["vid"]]
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 2 other locations - About 3 hrs to fix
                                                                                                        numbskull/inference.py on lines 214..215
                                                                                                        numbskull/inference.py on lines 224..225

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 65.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Identical blocks of code found in 3 locations. Consider refactoring.
                                                                                                        Open

                                                                                                                head = value if (fmap[ftv_end - 1]["vid"] == var_samp) \
                                                                                                                    else var_value[var_copy][fmap[ftv_end - 1]["vid"]]
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 2 other locations - About 3 hrs to fix
                                                                                                        numbskull/inference.py on lines 203..204
                                                                                                        numbskull/inference.py on lines 214..215

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 65.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Similar blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                            elif factor[factor_id]["factorFunction"] == FUNC_AND_CAT \
                                                                                                                    or factor[factor_id]["factorFunction"] == FUNC_EQUAL_CAT_CONST:
                                                                                                        Severity: Major
                                                                                                        Found in numbskull/inference.py and 1 other location - About 1 hr to fix
                                                                                                        numbskull/inference.py on lines 193..194

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 42.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                                abstain = variable[fmap[ftv_start]["vid"]]["cardinality"] - 1
                                                                                                        Severity: Minor
                                                                                                        Found in numbskull/inference.py and 1 other location - About 45 mins to fix
                                                                                                        numbskull/inference.py on lines 319..319

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 35.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        Identical blocks of code found in 2 locations. Consider refactoring.
                                                                                                        Open

                                                                                                                abstain = variable[fmap[ftv_start]["vid"]]["cardinality"] - 1
                                                                                                        Severity: Minor
                                                                                                        Found in numbskull/inference.py and 1 other location - About 45 mins to fix
                                                                                                        numbskull/inference.py on lines 386..386

                                                                                                        Duplicated Code

                                                                                                        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                                                                                                        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                                                                                                        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                                                                                                        Tuning

                                                                                                        This issue has a mass of 35.

                                                                                                        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                                                                                                        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                                                                                                        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                                                                                                        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                                                                                                        Refactorings

                                                                                                        Further Reading

                                                                                                        There are no issues that match your filters.

                                                                                                        Category
                                                                                                        Status