houtianze/bypy

View on GitHub

Showing 139 of 218 total issues

Avoid too many return statements within this function.
Open

        return const.ENoError
Severity: Major
Found in bypy/panapi.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                    return const.ENoError
    Severity: Major
    Found in bypy/bypy.py - About 30 mins to fix

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

          def format(self, obj, context, maxlevels, level):
              if isinstance(obj, unicode):
                  #return (obj.encode('utf8'), True, False)
                  return (obj, True, False)
              if isinstance(obj, bytes):
      Severity: Minor
      Found in bypy/util.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def help(command): # this comes first to make it easy to spot
              ''' Usage: help <command> - provide some information for the command '''
              for i, v in ByPy.__dict__.items():
                  if callable(v) and v.__doc__ and v.__name__ == command :
                      help = v.__doc__.strip()
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _select_fastest_mirror_act(self, r, args):
              pr("Selecting fastest mirror")
              j = r.json()
              self.pv("List of PCS mirrors:\n" + pprint.pformat(j))
              if 'path' not in j:
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _syncup_local_one(self, rpath, localdir, l):
              result = const.ENoError
              t = l[0]
              p = l[1]
              #lcpath = os.path.join(localdir, p) # local complete path
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _print_error_json(self, r):
              try:
                  dj = r.json()
                  if 'error_code' in dj and 'error_msg' in dj:
                      ec = dj['error_code']
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _proceed_list(self, walkresult, remotepath, dirjs, filejs, args):
              result = walkresult
              fmt = args
              # cutfront = const.AppPcsPathLen
              cutfront = len(remotepath) + 1
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _share_local(self, lpath, rpath, fast):
              if not os.path.exists(lpath):
                  perr("Local path '{}' does not exist.".format(lpath))
                  return const.EParameter
      
      
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _syncdown_single(self, rpath, localdir, compare_result):
              result = const.ENoError
              same, diff, local, remote = compare_result
              # clear the way
              for d in diff:
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _syncup_single(self, localdir, rpath, compare_result):
              result = const.ENoError
              same, diff, local, remote = compare_result
              # clear the way
              for d in diff:
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def allpath(self):
              result = []
      
              for k, v in self.items():
                  result.append(k)
      Severity: Minor
      Found in bypy/struct.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def share(self, path = '.', sharepath = '/', islocal = True, fast = False):
              islocal = str2bool(islocal)
              fast = str2bool(fast)
              if islocal:
                  lpath = path
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _compare_size(self, lsize, rjson):
              if 'size' in rjson:
                  rsize = rjson['size']
                  if lsize == rsize:
                      return 0
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

      def print_pcs_list_bare(list):
          if list:
              for f in list:
                  pr("{} {} {} {} {} {}".format(
                      ls_type(f['isdir']),
      Severity: Minor
      Found in bypy/util.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _store(self, info, path, value):
              cached.dirty = True
              info['size'] = getfilesize(path)
              info['mtime'] = getfilemtime_int(path)
              info[self.f.__name__] = value
      Severity: Minor
      Found in bypy/cached.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _syncdown_remote_one(self, rpath, localdir, r):
              result = const.ENoError
              t = r[0]
              p = r[1]
              #lcpath = os.path.join(localdir, p) # local complete path
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

          def _syncup_delete_remote(self, rpath, remote):
              result = const.ENoError
              # i think the list is built top-down, so directories appearing later are either
              # children or another set of directories
              pp = '\\' # previous path, setting to '\\' make sure it won't be found in the first step
      Severity: Minor
      Found in bypy/bypy.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

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

      def stringifypickle(picklecache):
          for absdir in picklecache:
              entry = picklecache[absdir]
              for file in entry:
                  info = entry[file]
      Severity: Minor
      Found in bypy/cached.py - About 25 mins to fix

      Cognitive Complexity

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

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

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

      Further reading

      Severity
      Category
      Status
      Source
      Language