cloudmatrix/esky

View on GitHub
esky/bdist_esky/__init__.py

Summary

Maintainability
F
1 wk
Test Coverage

File __init__.py has 708 lines of code (exceeds 250 allowed). Consider refactoring.
Open

#  Copyright (c) 2009-2010, Cloud Matrix Pty. Ltd.
#  All rights reserved; available under the terms of the BSD License.
"""

  esky.bdist_esky:  distutils command to freeze apps in esky format
Severity: Major
Found in esky/bdist_esky/__init__.py - About 1 day to fix

    Function get_executables has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring.
    Open

        def get_executables(self,normalise=True):
            """Yield a normalised Executable instance for each script to be frozen.
    
            If "normalise" is True (the default) then the user-provided scripts
            will be rewritten to decode any non-filename items specified as part
    Severity: Minor
    Found in esky/bdist_esky/__init__.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

    Function _find_msvcrt_manifest_files has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring.
    Open

        def _find_msvcrt_manifest_files(name):
            """Search the system for candidate MSVCRT manifest files.
    
            This method yields (manifest_file,msvcrt_dir) tuples giving a candidate
            manifest file for the given assembly name, and the directory in which
    Severity: Minor
    Found in esky/bdist_esky/__init__.py - About 7 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

    bdist_esky has 22 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class bdist_esky(Command):
        """Create a frozen application in 'esky' format.
    
        This distutils command can be used to freeze an application in the
        format expected by esky.  It interprets the following standard 
    Severity: Minor
    Found in esky/bdist_esky/__init__.py - About 2 hrs to fix

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

          def run(self):
              fullname = self.distribution.get_fullname()
              platform = get_platform()
              vdir = "%s.%s" % (fullname,platform,)
              appname = split_app_version(vdir)[0]
      Severity: Minor
      Found in esky/bdist_esky/__init__.py - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function get_msvcrt_private_assembly_files has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_msvcrt_private_assembly_files():
              """Get (source,destination) tuples for the MSVCRT DLLs, manifest etc.
      
              This method generates data_files tuples for the MSVCRT DLLs, manifest
              and associated paraphernalia.  Including these files is required for
      Severity: Minor
      Found in esky/bdist_esky/__init__.py - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def finalize_options(self):
              assert self.compress in (False, None, 'false', 'none', 'zip', 'ZIP'), 'Bad options passed to compress'
      
              self.set_undefined_options('bdist',('dist_dir', 'dist_dir'))
              if self.compile_bootstrap_exes and pypyc is None:
      Severity: Minor
      Found in esky/bdist_esky/__init__.py - About 2 hrs to fix

      Cognitive Complexity

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

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

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

      Further reading

      Function get_data_files has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_data_files(self):
              """Yield (source,destination) tuples for data files.
      
              This method generates the names of all data file to be included in
              the frozen app.  They should be placed directly into the freeze
      Severity: Minor
      Found in esky/bdist_esky/__init__.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 get_package_dir has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_package_dir(self,pkg):
              """Return directory where the given package is located.
      
              This was largely swiped from distutils, with some cleanups.
              """
      Severity: Minor
      Found in esky/bdist_esky/__init__.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 add_to_bootstrap_manifest has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def add_to_bootstrap_manifest(self,dstpath):
              if not os.path.isdir(os.path.join(self.freeze_dir,ESKY_CONTROL_DIR)):
                  os.mkdir(os.path.join(self.freeze_dir,ESKY_CONTROL_DIR))
              f_manifest = os.path.join(self.freeze_dir,ESKY_CONTROL_DIR,"bootstrap-manifest.txt")
              with open(f_manifest,"at") as f_manifest:
      Severity: Minor
      Found in esky/bdist_esky/__init__.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 get_package_data has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
      Open

          def get_package_data(self):
              """Yield (source,destination) tuples for package data files.
      
              This method generates the names of all package data files to be
              included in the frozen app.  They should be placed in the library.zip
      Severity: Minor
      Found in esky/bdist_esky/__init__.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 compile_to_bootstrap_exe has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def compile_to_bootstrap_exe(self,exe,source,relpath=None):
              """Compile the given sourcecode into a bootstrapping exe.
      
              This method compiles the given sourcecode into a stand-alone exe using
              PyPy, then stores that in the bootstrap env under the name of the given
      Severity: Minor
      Found in esky/bdist_esky/__init__.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 _run_create_zipfile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
      Open

          def _run_create_zipfile(self):
              """Zip up the final distribution."""
              if self.compress:
                  fullname = self.distribution.get_fullname()
                  platform = get_platform()
      Severity: Minor
      Found in esky/bdist_esky/__init__.py - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def name(self):
              if self._name is not None:
                  nm = self._name
              else:
                  if not isinstance(self.script,basestring):
      Severity: Minor
      Found in esky/bdist_esky/__init__.py - About 55 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Avoid deeply nested control flow statements.
      Open

                              if not self.dont_run_startup_hooks:
                                  fOut.write("import esky\n")
                                  fOut.write("esky.run_startup_hooks()\n")
                                  fOut.write("\n")
                              #  Then just include the rest of the script code.
      Severity: Major
      Found in esky/bdist_esky/__init__.py - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

                                with open(exe.script,"rt") as f:
                                    code = f.read()
                            else:
        Severity: Major
        Found in esky/bdist_esky/__init__.py - About 45 mins to fix

          Avoid deeply nested control flow statements.
          Open

                                  if name.lower() in fnm.lower():
                                      if fnm.lower().endswith(".manifest"):
                                          mf = os.path.join(subdir,fnm)
                                          md = cls._find_msvcrt_dir_for_manifest(name,mf)
                                          if md is not None:
          Severity: Major
          Found in esky/bdist_esky/__init__.py - About 45 mins to fix

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

                def __init__(self,script,name=None,icon=None,gui_only=None,
            Severity: Minor
            Found in esky/bdist_esky/__init__.py - About 45 mins to fix

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

                  def __init__(self,script,name=None,icon=None,gui_only=None,
                                    include_in_bootstrap_env=True,**kwds):
                      unicode.__init__(self)
                      if isinstance(script,Executable):
                          script = script.script
              Severity: Minor
              Found in esky/bdist_esky/__init__.py - About 45 mins to fix

              Cognitive Complexity

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

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

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

              Further reading

              Avoid deeply nested control flow statements.
              Open

                                      for ln in lines:
                                          fOut.write(ln)
                                  new_exe = Executable(script)
              Severity: Major
              Found in esky/bdist_esky/__init__.py - About 45 mins to fix

                Avoid deeply nested control flow statements.
                Open

                                        for ln in lines:
                                            if ln.strip():
                                                if not ln.strip().startswith("#"):
                                                    if "__future__" not in ln:
                                                        break
                Severity: Major
                Found in esky/bdist_esky/__init__.py - About 45 mins to fix

                  Avoid deeply nested control flow statements.
                  Open

                                              if info.encode() not in manifest_data:
                                                  break
                                          else:
                  Severity: Major
                  Found in esky/bdist_esky/__init__.py - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                            if os.sep != "/":
                                                dpath = dpath.replace(os.sep,"/")
                                            f_manifest.write(dpath)
                    Severity: Major
                    Found in esky/bdist_esky/__init__.py - About 45 mins to fix

                      Avoid too many return statements within this function.
                      Open

                                  return inspect.getsource(obj)
                      Severity: Major
                      Found in esky/bdist_esky/__init__.py - About 30 mins to fix

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

                            def get_bootstrap_code(self):
                                """Get any extra code to be executed by the bootstrapping exe.
                        
                                This method interprets the bootstrap-code and bootstrap-module settings
                                to construct any extra bootstrapping code that must be executed by
                        Severity: Minor
                        Found in esky/bdist_esky/__init__.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

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

                                for fnm in os.listdir(winsxs_m):
                                    if name.lower() in fnm.lower():
                                        if fnm.lower().endswith(".manifest"):
                                            mf = os.path.join(winsxs_m,fnm)
                                            md = cls._find_msvcrt_dir_for_manifest(name,mf)
                        Severity: Major
                        Found in esky/bdist_esky/__init__.py and 1 other location - About 5 hrs to fix
                        esky/bdist_esky/__init__.py on lines 656..662

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

                        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 fnm in os.listdir(winsxs):
                                    if name.lower() in fnm.lower():
                                        if fnm.lower().endswith(".manifest"):
                                            mf = os.path.join(winsxs,fnm)
                                            md = cls._find_msvcrt_dir_for_manifest(name,mf)
                        Severity: Major
                        Found in esky/bdist_esky/__init__.py and 1 other location - About 5 hrs to fix
                        esky/bdist_esky/__init__.py on lines 648..654

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

                        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 os.path.isdir(srcpath):
                                    self.copy_tree(srcpath,dstpath)
                                else:
                                    if not os.path.isdir(os.path.dirname(dstpath)):
                                       self.mkpath(os.path.dirname(dstpath))
                        Severity: Major
                        Found in esky/bdist_esky/__init__.py and 1 other location - About 4 hrs to fix
                        esky/finder.py on lines 429..434

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

                        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 3 locations. Consider refactoring.
                        Open

                        try:
                            from esky.bdist_esky import f_py2exe
                            _FREEZERS["py2exe"] = f_py2exe
                        except ImportError:
                            _FREEZERS["py2exe"] = None
                        Severity: Minor
                        Found in esky/bdist_esky/__init__.py and 2 other locations - About 30 mins to fix
                        esky/bdist_esky/__init__.py on lines 69..73
                        esky/bdist_esky/__init__.py on lines 74..78

                        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

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

                        try:
                            from esky.bdist_esky import f_py2app
                            _FREEZERS["py2app"] = f_py2app
                        except ImportError:
                            _FREEZERS["py2app"] = None
                        Severity: Minor
                        Found in esky/bdist_esky/__init__.py and 2 other locations - About 30 mins to fix
                        esky/bdist_esky/__init__.py on lines 64..68
                        esky/bdist_esky/__init__.py on lines 74..78

                        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

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

                        try:
                            from esky.bdist_esky import f_bbfreeze
                            _FREEZERS["bbfreeze"] = f_bbfreeze
                        except ImportError:
                            _FREEZERS["bbfreeze"] = None
                        Severity: Minor
                        Found in esky/bdist_esky/__init__.py and 2 other locations - About 30 mins to fix
                        esky/bdist_esky/__init__.py on lines 64..68
                        esky/bdist_esky/__init__.py on lines 69..73

                        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

                        There are no issues that match your filters.

                        Category
                        Status