cloudmatrix/esky

View on GitHub

Showing 175 of 271 total issues

Function sorted has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
Open

    def sorted(lst,reverse=False):
        slst = []
        if reverse:
            for item in lst:
                for j in xrange(len(slst)):
Severity: Minor
Found in esky/bootstrap.py - About 4 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

Patcher has 32 functions (exceeds 20 allowed). Consider refactoring.
Open

class Patcher(object):
    """Class interpreting our patch protocol.

    Instances of this class can be used to apply a sequence of patch commands
    to a target file or directory.  You can think of it as a little automaton
Severity: Minor
Found in esky/patch.py - About 4 hrs to fix

    Function paths_differ has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

    def paths_differ(path1,path2):
        """Check whether two paths differ."""
        if os.path.isdir(path1):
            if not os.path.isdir(path2):
                return True
    Severity: Minor
    Found in esky/patch.py - About 3 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 uninstall_version has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

        def uninstall_version(self, version):
            """Uninstall the specified version of the app."""
            if self.sudo_proxy is not None:
                return self.sudo_proxy.uninstall_version(version)
            vsdir = self._get_versions_dir()
    Severity: Minor
    Found in esky/__init__.py - About 3 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

    libpython has 31 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class libpython(object):
    
        file_input = 257
    
    
    
    Severity: Minor
    Found in esky/bdist_esky/pypy_libpython.py - About 3 hrs to fix

      Function execv has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring.
      Open

          def execv(filename,args):
              #  Create an O_TEMPORARY file and pass its name to the slave process.
              #  When this master process dies, the file will be deleted and the
              #  slave process will know to terminate.
              try:
      Severity: Minor
      Found in esky/bootstrap.py - About 3 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

      Esky has 29 functions (exceeds 20 allowed). Consider refactoring.
      Open

      class Esky(object):
          """Class representing an updatable frozen app.
      
          Instances of this class point to a directory containing a frozen app in
          the esky format.  Through such an instance the app can be updated to a
      Severity: Minor
      Found in esky/__init__.py - About 3 hrs to fix

        Function lock has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def lock(self, num_retries=0):
                """Lock the application directory for exclusive write access.
        
                If the appdir is already locked by another process/thread then
                EskyLockedError is raised.  There is no way to perform a blocking
        Severity: Minor
        Found in esky/__init__.py - About 3 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 auto_update has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def auto_update(self, callback=None):
                """Automatically install the latest version of the app.
        
                This method automatically performs the following sequence of actions,
                escalating to root privileges if a permission error is encountered:
        Severity: Minor
        Found in esky/__init__.py - About 3 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 _diff_binary_file has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def _diff_binary_file(self,source,target):
                """Diff a generic binary file.
        
                This is the per-file diffing method used when we don't know enough
                about the file to do anything fancier.  It's basically a windowed
        Severity: Minor
        Found in esky/patch.py - About 3 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 _unpack_bootstrap_env has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring.
        Open

            def _unpack_bootstrap_env(self, target, trn):
                """Unpack the bootstrap env from the given target directory."""
                vdir = os.path.basename(target)
                #  Move new bootrapping environment into main app dir.
                #  Be sure to move dependencies before executables.
        Severity: Minor
        Found in esky/__init__.py - About 3 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 _chainload has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        def _chainload(target_dir):
            """Default implementation of the chainload() function.
        
            Specific freezer modules may provide a more efficient, reliable or
            otherwise better version of this function.
        Severity: Minor
        Found in esky/bootstrap.py - About 3 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 really_rmtree has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
        Open

        def really_rmtree(path):
            """Like shutil.rmtree, but try to work around some win32 wierdness.
        
            Every so often windows likes to throw a spurious error about not being
            able to remove a directory - like claiming it still contains files after
        Severity: Minor
        Found in esky/util.py - About 3 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 _move has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
        Open

            def _move(self,source,target):
                if sys.platform == "win32" and os.path.exists(target):
                    #  os.rename won't overwite an existing file on win32.
                    #  We also want to use this on files that are potentially open.
                    #  Renaming the target out of the way is the best we can do :-(
        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 _cleanup_patch has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

            def _cleanup_patch(self):
                '''Go throught the appdata folder of the new version and remove any files not 
                in the filelist. If there is no filelist we do nothing
                This prevents us from leaving old .pyc or .pyo files behind if we for instance 
                change a module into a folder instead of a single file.
        Severity: Minor
        Found in esky/patch.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 _link has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

              def _link(self,cc,ofiles,link_args,standalone,exe_name):
                  #  Link against windows subsystem if gui-only is specified.
                  if self.gui_only:
                      link_args.append("/subsystem:windows")
                  #  Choose whether to link crt statically or dynamically.
        Severity: Minor
        Found in esky/bdist_esky/pypyc.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 find_resource has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
        Open

        def find_resource(filename_or_handle,res_type,res_id,res_lang=None):
            """Locate a resource inside the given file or module handle.
        
            This function returns a tuple (start,end) giving the location of the
            specified resource inside the given module.
        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

        Function __getattr__ has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def __getattr__(self,attr):
                if attr.startswith("_"):
                    raise AttributeError(attr)
                target = self.__dict__["target"]
                if _get_sudo_argtypes(target,attr) is None:
        Severity: Minor
        Found in esky/sudo/__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 move has a Cognitive Complexity of 19 (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/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 _fetch_file_iter has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

            def _fetch_file_iter(self,app,url):
                nm = os.path.basename(urlparse(url).path)
                outfilenm = os.path.join(self._workdir(app,"downloads"),nm)
                if not os.path.exists(outfilenm):
                    try:
        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