cloudmatrix/esky

View on GitHub

Showing 271 of 271 total issues

File __init__.py has 271 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.sudo:  spawn a root-privileged helper app to process esky updates.
Severity: Minor
Found in esky/sudo/__init__.py - About 2 hrs to fix

    Function move has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def move(self,source,target):
            source = self._check_path(source)
            target = self._check_path(target)
            if os.path.isdir(source):
                if os.path.isdir(target):
    Severity: Minor
    Found in esky/fstransact/win32txf.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 _try_remove has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def _try_remove(self, tdir, path, manifest=[]):
            """Try to remove the file/directory at given path in the target dir.
    
            This method attempts to remove the file or directory at the given path,
            but will fail silently under a number of conditions:
    Severity: Minor
    Found in 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 copy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def copy(self,source,target):
            source = self._check_path(source)
            target = self._check_path(target)
            if os.path.isdir(source):
                if os.path.isdir(target):
    Severity: Minor
    Found in esky/fstransact/fallback.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 copy has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

        def copy(self,source,target):
            source = self._check_path(source)
            target = self._check_path(target)
            if os.path.isdir(source):
                if os.path.isdir(target):
    Severity: Minor
    Found in esky/fstransact/win32txf.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 is_safe_to_overwrite has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
    Open

    def is_safe_to_overwrite(source,target):
        """Check whether it is safe to overwrite target exe with source exe.
    
        This function checks whether two exe files 'source' and 'target' differ
        only in the contents of certain non-critical resource segments.  If so,
    Severity: Minor
    Found in esky/winres.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

    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

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

          def Eval_GetBuiltins(self):
              impl = self.lib.getpointer("PyEval_GetBuiltins",[],clibffi.ffi_type_pointer)
              d = impl.call(rffi.VOIDP)
              if not d:
                  self._error()
      Severity: Major
      Found in esky/bdist_esky/pypy_libpython.py and 1 other location - About 2 hrs to fix
      esky/bdist_esky/pypy_libpython.py on lines 215..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 54.

      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

                      if os.path.isfile(target):
                          target_zip = target
                          target = os.path.join(workdir,"target")
                          if opts.deep_zipped:
                              deep_extract_zipfile(target_zip,target)
      Severity: Major
      Found in esky/patch.py and 2 other locations - About 2 hrs to fix
      esky/patch.py on lines 1375..1381
      esky/patch.py on lines 1401..1408

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

      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

                  if opts.zipped:
                      if os.path.isfile(target):
                          target_zip = target
                          target = os.path.join(workdir,"target")
                          if opts.deep_zipped:
      Severity: Major
      Found in esky/patch.py and 2 other locations - About 2 hrs to fix
      esky/patch.py on lines 1375..1381
      esky/patch.py on lines 1382..1388

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

      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

          def Dict_New(self):
              impl = self.lib.getpointer("PyDict_New",[],clibffi.ffi_type_pointer)
              d = impl.call(rffi.VOIDP)
              if not d:
                  self._error()
      Severity: Major
      Found in esky/bdist_esky/pypy_libpython.py and 1 other location - About 2 hrs to fix
      esky/bdist_esky/pypy_libpython.py on lines 150..155

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

      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

                      if os.path.isfile(source):
                          source_zip = source
                          source = os.path.join(workdir,"source")
                          if opts.deep_zipped:
                              deep_extract_zipfile(source_zip,source)
      Severity: Major
      Found in esky/patch.py and 2 other locations - About 2 hrs to fix
      esky/patch.py on lines 1382..1388
      esky/patch.py on lines 1401..1408

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

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

      def _split_version_components(s):
          """Split version string into individual tokens.
      
          pkg_resources does this using a regexp: (\d+ | [a-z]+ | \.| -)
          Unfortunately the 're' module isn't in the bootstrap, so we have to do
      Severity: Minor
      Found in esky/bootstrap.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 spawn_sudo has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def spawn_sudo(proxy):
          """Spawn the sudo slave process, returning proc and a pipe to message it."""
      
          pipe = SecureStringPipe()
          c_pipe = pipe.connect()
      Severity: Minor
      Found in esky/sudo/sudo_osx.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_exe_locations has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def get_exe_locations(target_dir):
          """Generate possible locations from which to chainload in the target dir."""
          # TODO: let this be a generator when not compiling with PyPy, so we can
          # avoid a few stat() calls in the common case.
          locs = []
      Severity: Minor
      Found in esky/bootstrap.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 extract_zipfile has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Open

      def extract_zipfile(source,target,name_filter=None):
          """Extract the contents of a zipfile into a target directory.
      
          The argument 'source' names the zipfile to read, while 'target' names
          the directory into which to extract.  If given, the optional argument
      Severity: Minor
      Found in esky/util.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 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

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

      def _get_sudo_iterator(obj,methname):
          """Get the iterator flag for the given method.
      
          This searches the base classes of obj if the given method is not declared
          allowed_from_sudo, so that people don't have to constantly re-apply the
      Severity: Major
      Found in esky/sudo/__init__.py and 1 other location - About 2 hrs to fix
      esky/sudo/__init__.py on lines 279..293

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

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

          def fetch_version_iter(self,app,version):
              #  There's always the possibility that a file fails to download or 
              #  that a patch fails to apply.  _fetch_file_iter and _prepare_version
              #  will remove such files from the version graph; we loop until we find
              #  a patch path that works, or we run out of options.
      Severity: Minor
      Found in esky/finder.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

      Severity
      Category
      Status
      Source
      Language