CosmicFish/CosmicFish

View on GitHub

Showing 209 of 209 total issues

File fisher_plot.py has 876 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#----------------------------------------------------------------------------------------
#
# This file is part of CosmicFish.
#
# Copyright (C) 2015-2017 by the CosmicFish authors
Severity: Major
Found in python/cosmicfish_pylib/fisher_plot.py - About 2 days to fix

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

            if params==None and names==None:
                names_temp  = copy.deepcopy(all_names)
                params_temp = copy.deepcopy(all_params)
            elif params==None and names!=None:
                names_temp  = [i for i in fu.make_list(names) if i in all_names]
    Severity: Major
    Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 2 days to fix
    python/cosmicfish_pylib/fisher_plot.py on lines 351..362

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

    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

            if params==None and names==None:
                names_temp  = copy.deepcopy(all_names)
                params_temp = copy.deepcopy(all_params)
            elif params==None and names!=None:
                names_temp  = [i for i in fu.make_list(names) if i in all_names]
    Severity: Major
    Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 2 days to fix
    python/cosmicfish_pylib/fisher_plot.py on lines 187..198

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

    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 search_fisher_path has a Cognitive Complexity of 84 (exceeds 5 allowed). Consider refactoring.
    Open

        def search_fisher_path(self, fisher_path, search_fisher_guess=False, with_derived=True):
            """
            Searches a path for fisher matrices.
            Will detect wether fisher_path contains directly the paths to the Fisher files or folder.
            If a list of folders is passed all the folders will be searched, first for Fisher matrices
    Severity: Minor
    Found in python/cosmicfish_pylib/fisher_plot_analysis.py - About 1 day 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

            if not show_y_ticks_labels:
                subplot.set_yticklabels([])
            else:
                yticks = np.linspace(ranges[param2][0], ranges[param2][1], number_y_ticks)
                subplot.set_yticks(yticks)
    Severity: Major
    Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 1 day to fix
    python/cosmicfish_pylib/fisher_plot.py on lines 652..660

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

    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

            if not show_x_ticks_labels:
                subplot.set_xticklabels([])
            else:
                xticks = np.linspace(ranges[param1][0], ranges[param1][1], number_x_ticks)
                subplot.set_xticks(xticks)
    Severity: Major
    Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 1 day to fix
    python/cosmicfish_pylib/fisher_plot.py on lines 662..670

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

    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

            for plot in list(self.plot_dict.values()):
                x_dimension = plot.yaxis.get_label().get_window_extent(renderer).width/default_dpi  #: in inches
                y_dimension = plot.yaxis.get_label().get_window_extent(renderer).height/default_dpi  #: in inches
                if x_dimension>max_y_label[0]: max_y_label[0]=x_dimension
                if y_dimension>max_y_label[1]: max_y_label[1]=y_dimension
    Severity: Major
    Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 7 hrs to fix
    python/cosmicfish_pylib/fisher_plot.py on lines 815..819

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

    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

            for plot in list(self.plot_dict.values()):
                x_dimension = plot.xaxis.get_label().get_window_extent(renderer).width/default_dpi  #: in inches
                y_dimension = plot.xaxis.get_label().get_window_extent(renderer).height/default_dpi  #: in inches
                if x_dimension>max_x_label[0]: max_x_label[0]=x_dimension
                if y_dimension>max_x_label[1]: max_x_label[1]=y_dimension
    Severity: Major
    Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 7 hrs to fix
    python/cosmicfish_pylib/fisher_plot.py on lines 807..811

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

    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

    File fisher_matrix.py has 492 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    #----------------------------------------------------------------------------------------
    #
    # This file is part of CosmicFish.
    #
    # Copyright (C) 2015-2017 by the CosmicFish authors
    Severity: Minor
    Found in python/cosmicfish_pylib/fisher_matrix.py - About 7 hrs to fix

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

              for plot in list(self.plot_dict.values()):
                  for xlabel in plot.get_xticklabels():
                      x_dimension = xlabel.get_window_extent(renderer).width/default_dpi  #: in inches
                      y_dimension = xlabel.get_window_extent(renderer).height/default_dpi  #: in inches
                      if x_dimension>max_x_tick_label[0]: max_x_tick_label[0]=x_dimension
      Severity: Major
      Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 7 hrs to fix
      python/cosmicfish_pylib/fisher_plot.py on lines 789..794

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

      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

              for plot in list(self.plot_dict.values()):
                  for ylabel in plot.get_yticklabels():
                      x_dimension = ylabel.get_window_extent(renderer).width/default_dpi  #: in inches
                      y_dimension = ylabel.get_window_extent(renderer).height/default_dpi  #: in inches
                      if x_dimension>max_y_tick_label[0]: max_y_tick_label[0]=x_dimension
      Severity: Major
      Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 7 hrs to fix
      python/cosmicfish_pylib/fisher_plot.py on lines 798..803

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

      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

              y_size = num_rows*subplot_y_size/inch_to_cm +1.0*(dimensions['xtick_pad'] +2.0*dimensions['label_pad'] +dimensions['x_tick_labels'][1] +dimensions['x_labels'][1]) +(num_rows-1.0)*tri_subspace/inch_to_cm
      Severity: Major
      Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 7 hrs to fix
      python/cosmicfish_pylib/fisher_plot.py on lines 995..995

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

      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

              x_size = num_col*subplot_x_size/inch_to_cm +2.0*(dimensions['ytick_pad'] +2.0*dimensions['label_pad'] +dimensions['y_tick_labels'][0] +dimensions['y_labels'][0]) +(num_col-1.0)*tri_subspace/inch_to_cm
      Severity: Major
      Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 7 hrs to fix
      python/cosmicfish_pylib/fisher_plot.py on lines 996..996

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

      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

      Cyclomatic complexity is too high in method set_plot_dimensions. (35)
      Open

          def set_plot_dimensions(self, num_col, num_rows, **kwargs):
              """
              Sets the dimensions of the plot based on the settings passed.
      
              :param num_col: number of colums in the plot grid.

      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 fisher_plot_analysis.py has 436 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      #----------------------------------------------------------------------------------------
      #
      # This file is part of CosmicFish.
      #
      # Copyright (C) 2015-2017 by the CosmicFish authors
      Severity: Minor
      Found in python/cosmicfish_pylib/fisher_plot_analysis.py - About 6 hrs to fix

        Function set_plot_dimensions has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring.
        Open

            def set_plot_dimensions(self, num_col, num_rows, **kwargs):
                """
                Sets the dimensions of the plot based on the settings passed.
        
                :param num_col: number of colums in the plot grid.
        Severity: Minor
        Found in python/cosmicfish_pylib/fisher_plot.py - About 6 hrs to fix

        Cognitive Complexity

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

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

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

        Further reading

        Cyclomatic complexity is too high in method set_triplot_dimensions. (33)
        Open

            def set_triplot_dimensions(self, num_col, num_rows, **kwargs):
                """
                Sets the dimensions of the triangular plot based on the settings passed.
                This is different from the other dimension setter because triplots need some
                personalization.

        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

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

                if use_fixed_figure_width and use_fixed_figure_height:
                    # both sizes fixed. Do nothing, just copy the setting.
                    x_size = x_size_in/inch_to_cm
                    y_size = y_size_in/inch_to_cm
                elif use_fixed_figure_width and not use_fixed_figure_height:
        Severity: Major
        Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 6 hrs to fix
        python/cosmicfish_pylib/fisher_plot.py on lines 890..898

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

        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

                if use_fixed_figure_width and use_fixed_figure_height:
                    # both sizes fixed. Do nothing, just copy the setting.
                    x_size = x_size_in/inch_to_cm
                    y_size = y_size_in/inch_to_cm
                elif use_fixed_figure_width and not use_fixed_figure_height:
        Severity: Major
        Found in python/cosmicfish_pylib/fisher_plot.py and 1 other location - About 6 hrs to fix
        python/cosmicfish_pylib/fisher_plot.py on lines 1012..1020

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

        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

                if derived_matrix is None:
                    # initialize from file:
                    self.derived_matrix = np.loadtxt(file_name)
                    # get the file name and path:
                    self.path = os.path.abspath(file_name)
        Severity: Major
        Found in python/cosmicfish_pylib/fisher_derived.py and 1 other location - About 6 hrs to fix
        python/cosmicfish_pylib/fisher_matrix.py on lines 223..232

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

        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

        Severity
        Category
        Status
        Source
        Language