aliciawyy/dmining

View on GitHub

Showing 35 of 35 total issues

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

def print_insertion_sort2(arr):
    for i in range(1, len(arr)):
        num_i = arr[i]
        k = i
        for j in range(i - 1, -1, -1):
Severity: Minor
Found in puzzle/sorting.py - About 45 mins to fix

Cognitive Complexity

Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

A method's cognitive complexity is based on a few simple rules:

  • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
  • Code is considered more complex for each "break in the linear flow of the code"
  • Code is considered more complex when "flow breaking structures are nested"

Further reading

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

    def _partial_fit(self, X, y, classes=None, _refit=False,
Severity: Minor
Found in models/classifiers.py - About 35 mins to fix

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

    def update_mean_variance(n_past, mu, var, X, sample_weight=None):
    Severity: Minor
    Found in models/classifiers.py - About 35 mins to fix

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

      def shortest_palindromes(base):
          if len(base) <= 1:
              return base
          if is_palindrome(base):
              return base
      Severity: Minor
      Found in puzzle/palindrome.py - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

      def sort_merge_string(x, y):
          result = ''
          while len(x) > 0 or len(y) > 0:
              if len(x) == 0:
                  result += y
      Severity: Minor
      Found in puzzle/palindrome.py - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

      rx.Observable.zip(letters, source1, lambda a, b: "{}-{}".format(a, b)) \
      Severity: Minor
      Found in rx_tutorial/rx_tuto3.py and 1 other location - About 35 mins to fix
      rx_tutorial/rx_tuto3.py on lines 42..42

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

      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

      rx.Observable.zip(letters, numbers, lambda a, b: "{}-{}".format(a, b)) \
      Severity: Minor
      Found in rx_tutorial/rx_tuto3.py and 1 other location - About 35 mins to fix
      rx_tutorial/rx_tuto3.py on lines 56..56

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

      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

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

      def make_sum(dct_values, base=None):
          """base is some previous result"""
          sum_cnt = collections.defaultdict(int)
          if base is not None:
              sum_cnt.update(base)
      Severity: Minor
      Found in puzzle/jewelry.py - About 35 mins to fix

      Cognitive Complexity

      Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

      A method's cognitive complexity is based on a few simple rules:

      • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
      • Code is considered more complex for each "break in the linear flow of the code"
      • Code is considered more complex when "flow breaking structures are nested"

      Further reading

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

          def _in_range_x(self, point):
              return 0 <= point[0] < self.dim[0]
      Severity: Minor
      Found in puzzle/booking/candy.py and 1 other location - About 30 mins to fix
      puzzle/booking/candy.py on lines 27..28

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

      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

      Avoid too many return statements within this function.
      Open

              return _all_star(p2[idx2:])
      Severity: Major
      Found in puzzle/pattern_overlap.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return _all_star(p1[idx1:])
        Severity: Major
        Found in puzzle/pattern_overlap.py - About 30 mins to fix

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

              def _in_range_y(self, point):
                  return 0 <= point[1] < self.dim[1]
          Severity: Minor
          Found in puzzle/booking/candy.py and 1 other location - About 30 mins to fix
          puzzle/booking/candy.py on lines 24..25

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

          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

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

              def min_sums(self, numbers, n_sum):
                  self.set_numbers(numbers)
                  n = len(self.numbers_)
          
                  all_sums_cnt = [None] * n
          Severity: Minor
          Found in puzzle/quick_sum.py - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

          def fit_id3(x, y, criterion="entropy"):
              # x, y are supposed to be pandas DataFrame format
              partition_disorder = functools.partial(util.partition_disorder, y=y, criterion=criterion)
              disorder_by_feature = x.apply(partition_disorder)
              min_disorder_feature = np.argmin(disorder_by_feature)
          Severity: Minor
          Found in models/tree.py - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

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

              def how_many(self, values):
                  self.set_values(values)
                  count = 0
                  values_for_above = dict(self.values_)
          
          
          Severity: Minor
          Found in puzzle/jewelry.py - About 25 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          Severity
          Category
          Status
          Source
          Language