houtianze/bypy

View on GitHub

Showing 218 of 218 total issues

Function pinfo has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

def pinfo(msg, showtime = True, showdate = False, prefix = '', suffix = ''):
Severity: Minor
Found in bypy/printer.py - About 35 mins to fix

    Function _walk_remote_dir has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

        def _walk_remote_dir(self, remotepath, remoterootpath, args = None, skip_remote_only_dirs = False, recursive = True):
    Severity: Minor
    Found in bypy/bypy.py - About 35 mins to fix

      Function _is_error_response has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _is_error_response(self, r):
              # don't attempt on large contents
              isJson = False
              ContentTypeKey = 'Content-Type'
              contentType = r.headers.get(ContentTypeKey)
      Severity: Minor
      Found in bypy/bypy.py - About 35 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_diff_one has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _syncdown_diff_one(self, rpath, localdir, d):
              result = const.ENoError
              t = d[0]
              p = d[1]
              #lcpath = os.path.join(localdir, p) # local complete path
      Severity: Minor
      Found in bypy/bypy.py - About 35 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 _get_json_errorcode has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _get_json_errorcode(self, r, act, defaultec = const.ERequestFailed):
              try:
                  j = r.json()
                  self.pd("Website returned JSON: {}".format(j))
                  if 'error_code' in j:
      Severity: Minor
      Found in bypy/bypy.py - About 35 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

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

              if self._verify:
                  self._current_file_size = getfilesize(self._current_file)
                  result = self._verify_current_file(self._remote_json, False)
      Severity: Minor
      Found in bypy/bypy.py and 1 other location - About 35 mins to fix
      bypy/bypy.py on lines 2129..2131

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

      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

                      perr("Remote extract: '{}#{}' =xx=> '{}' FAILED. File already exists.".format(args['path'], args['subpath'], args['topath']))
      Severity: Minor
      Found in bypy/panapi.py and 1 other location - About 35 mins to fix
      bypy/panapi.py on lines 120..120

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

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

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

              if self._verify:
                  self._current_file_size = getfilesize(self._current_file)
                  result = self._verify_current_file(self._remote_json, False)
      Severity: Minor
      Found in bypy/bypy.py and 1 other location - About 35 mins to fix
      bypy/bypy.py on lines 2011..2013

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

      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

                      perr("Remote extract: '{}#{}' =xx=> '{}' FAILED. File too large.".format(args['path'], args['subpath'], args['topath']))
      Severity: Minor
      Found in bypy/panapi.py and 1 other location - About 35 mins to fix
      bypy/panapi.py on lines 113..113

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

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

          def _panapi_unzip_file_act(self, r, args):
              j = r.json()
              self.pd("Unzip response: {}".format(j))
              if j['errno'] == 0:
                  if 'time' in j:
      Severity: Minor
      Found in bypy/panapi.py - About 35 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 _cdl_mon_act has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _cdl_mon_act(self, r, args):
              try:
                  task_id, start_time, done = args
                  j = r.json()
                  ti = j['task_info'][str(task_id)]
      Severity: Minor
      Found in bypy/bypy.py - About 35 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_downdir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def _proceed_downdir(self, walkresult, remotepath, dirjs, filejs, args):
              result = walkresult
              rootrpath, localpath = args
              #rlen = len(remotepath) + 1
              rootlen = len(rootrpath) + 1 # '+ 1' for the trailing '/', it bites.
      Severity: Minor
      Found in bypy/bypy.py - About 35 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 too many return statements within this function.
      Open

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

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

                for l in local:
                    pr("{} - {}".format(l[0], l[1]))
        Severity: Major
        Found in bypy/bypy.py and 3 other locations - About 30 mins to fix
        bypy/bypy.py on lines 2796..2797
        bypy/bypy.py on lines 2800..2801
        bypy/bypy.py on lines 2808..2809

        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

        Avoid too many return statements within this function.
        Open

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

          Avoid too many return statements within this function.
          Open

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

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

                    for c in same:
                        pr("{} - {}".format(c[0], c[1]))
            Severity: Major
            Found in bypy/bypy.py and 3 other locations - About 30 mins to fix
            bypy/bypy.py on lines 2800..2801
            bypy/bypy.py on lines 2804..2805
            bypy/bypy.py on lines 2808..2809

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

                def _delete_children(self, rpath):
                    pars = {
                        'method' : 'list',
                        'path' : rpath}
            
            
            Severity: Minor
            Found in bypy/bypy.py and 1 other location - About 30 mins to fix
            bypy/bypy.py on lines 2650..2654

            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

            Avoid too many return statements within this function.
            Open

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

              Avoid too many return statements within this function.
              Open

                          return True
              Severity: Major
              Found in bypy/bypy.py - About 30 mins to fix
                Severity
                Category
                Status
                Source
                Language