saltstack/salt

View on GitHub
salt/fileserver/__init__.py

Summary

Maintainability
F
1 wk
Test Coverage

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

# -*- coding: utf-8 -*-
'''
File server pluggable modules and generic backend functions
'''

Severity: Major
Found in salt/fileserver/__init__.py - About 1 day to fix

    Function clear_file_list_cache has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

        def clear_file_list_cache(self, load):
            '''
            Deletes the file_lists cache files
            '''
            if 'env' in load:
    Severity: Minor
    Found in salt/fileserver/__init__.py - About 5 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 check_file_list_cache has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring.
    Open

    def check_file_list_cache(opts, form, list_cache, w_lock):
        '''
        Checks the cache file to see if there is a new enough file list cache, and
        returns the match (if found, along with booleans used by the fileserver
        backend to determine if the cache needs to be refreshed/written).
    Severity: Minor
    Found in salt/fileserver/__init__.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

    Function find_file has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def find_file(self, path, saltenv, back=None):
            '''
            Find the path and return the fnd structure, this structure is passed
            to other backend interfaces.
            '''
    Severity: Minor
    Found in salt/fileserver/__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 backends has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
    Open

        def backends(self, back=None):
            '''
            Return the backend list
            '''
            if not back:
    Severity: Minor
    Found in salt/fileserver/__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 reap_fileserver_cache_dir has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
    Open

    def reap_fileserver_cache_dir(cache_base, find_func):
        '''
        Remove unused cache items assuming the cache directory follows a directory
        convention:
    
    
    Severity: Minor
    Found in salt/fileserver/__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 generate_mtime_map has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
    Open

    def generate_mtime_map(opts, path_map):
        '''
        Generate a dict of filename -> mtime
        '''
        file_map = {}
    Severity: Minor
    Found in salt/fileserver/__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

    Fileserver has 24 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class Fileserver(object):
        '''
        Create a fileserver wrapper object that wraps the fileserver functions and
        iterates over them to execute the desired function within the scope of the
        desired fileserver backend.
    Severity: Minor
    Found in salt/fileserver/__init__.py - About 2 hrs to fix

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

      def wait_lock(lk_fn, dest, wait_timeout=0):
          '''
          If the write lock is there, check to see if the file is actually being
          written. If there is no change in the file size after a short sleep,
          remove the lock and move forward.
      Severity: Minor
      Found in salt/fileserver/__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

      Cyclomatic complexity is too high in method clear_file_list_cache. (23)
      Open

          def clear_file_list_cache(self, load):
              '''
              Deletes the file_lists cache files
              '''
              if 'env' in load:
      Severity: Minor
      Found in salt/fileserver/__init__.py by radon

      Cyclomatic Complexity

      Cyclomatic Complexity corresponds to the number of decisions a block of code contains plus 1. This number (also called McCabe number) is equal to the number of linearly independent paths through the code. This number can be used as a guide when testing conditional logic in blocks.

      Radon analyzes the AST tree of a Python program to compute Cyclomatic Complexity. Statements have the following effects on Cyclomatic Complexity:

      Construct Effect on CC Reasoning
      if +1 An if statement is a single decision.
      elif +1 The elif statement adds another decision.
      else +0 The else statement does not cause a new decision. The decision is at the if.
      for +1 There is a decision at the start of the loop.
      while +1 There is a decision at the while statement.
      except +1 Each except branch adds a new conditional path of execution.
      finally +0 The finally block is unconditionally executed.
      with +1 The with statement roughly corresponds to a try/except block (see PEP 343 for details).
      assert +1 The assert statement internally roughly equals a conditional statement.
      Comprehension +1 A list/set/dict comprehension of generator expression is equivalent to a for loop.
      Boolean Operator +1 Every boolean operator (and, or) adds a decision point.

      Source: http://radon.readthedocs.org/en/latest/intro.html

      Function is_file_ignored has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
      Open

      def is_file_ignored(opts, fname):
          '''
          If file_ignore_regex or file_ignore_glob were given in config,
          compare the given file path against all of them and return True
          on the first match.
      Severity: Minor
      Found in salt/fileserver/__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 lock has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

          def lock(self, back=None, remote=None):
              '''
              ``remote`` can either be a dictionary containing repo configuration
              information, or a pattern. If the latter, then remotes for which the URL
              matches the pattern will be locked.
      Severity: Minor
      Found in salt/fileserver/__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 envs has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def envs(self, back=None, sources=False):
              '''
              Return the environments for the named backend or all backends
              '''
              back = self.backends(back)
      Severity: Minor
      Found in salt/fileserver/__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

                              if is_file_ignored(opts, file_path):
                                  continue
                              file_map[file_path] = os.path.getmtime(file_path)
      Severity: Major
      Found in salt/fileserver/__init__.py - About 45 mins to fix

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

            def file_list(self, load):
                '''
                Return a list of files from the dominant environment
                '''
                if 'env' in load:
        Severity: Minor
        Found in salt/fileserver/__init__.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 symlink_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def symlink_list(self, load):
                '''
                Return a list of symlinked files and dirs
                '''
                if 'env' in load:
        Severity: Minor
        Found in salt/fileserver/__init__.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 clear_cache has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def clear_cache(self, back=None):
                '''
                Clear the cache of all of the fileserver backends that support the
                clear_cache function or the named backend(s) only.
                '''
        Severity: Minor
        Found in salt/fileserver/__init__.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 file_list_emptydirs has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def file_list_emptydirs(self, load):
                '''
                List all emptydirs in the given environment
                '''
                if 'env' in load:
        Severity: Minor
        Found in salt/fileserver/__init__.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 dir_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def dir_list(self, load):
                '''
                List all directories in the given environment
                '''
                if 'env' in load:
        Severity: Minor
        Found in salt/fileserver/__init__.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 False
        Severity: Major
        Found in salt/fileserver/__init__.py - About 30 mins to fix

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

              def serve_file(self, load):
                  '''
                  Serve up a chunk of a file
                  '''
                  ret = {'data': '',
          Severity: Minor
          Found in salt/fileserver/__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

              @ensure_unicode_args
              def file_list(self, load):
                  '''
                  Return a list of files from the dominant environment
                  '''
          Severity: Major
          Found in salt/fileserver/__init__.py and 1 other location - About 1 day to fix
          salt/fileserver/__init__.py on lines 821..844

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

          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

              @ensure_unicode_args
              def dir_list(self, load):
                  '''
                  List all directories in the given environment
                  '''
          Severity: Major
          Found in salt/fileserver/__init__.py and 1 other location - About 1 day to fix
          salt/fileserver/__init__.py on lines 771..794

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

          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 not isinstance(saltenv, list):
                          try:
                              saltenv = [x.strip() for x in saltenv.split(',')]
                          except AttributeError:
                              saltenv = [x.strip() for x in six.text_type(saltenv).split(',')]
          Severity: Major
          Found in salt/fileserver/__init__.py and 1 other location - About 3 hrs to fix
          salt/modules/pip.py on lines 867..871

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

          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 _find_file(self, load):
                  '''
                  Convenience function for calls made using the RemoteClient
                  '''
                  path = load.get('path')
          Severity: Major
          Found in salt/fileserver/__init__.py and 1 other location - About 2 hrs to fix
          salt/fileserver/__init__.py on lines 570..579

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

          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 file_find(self, load):
                  '''
                  Convenience function for calls made using the LocalClient
                  '''
                  path = load.get('path')
          Severity: Major
          Found in salt/fileserver/__init__.py and 1 other location - About 2 hrs to fix
          salt/fileserver/__init__.py on lines 559..568

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

          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 opts['file_ignore_glob']:
                  for glob in opts['file_ignore_glob']:
                      if fnmatch.fnmatch(fname, glob):
                          log.debug(
                              'File matching file_ignore_glob. Skipping: %s',
          Severity: Major
          Found in salt/fileserver/__init__.py and 1 other location - About 1 hr to fix
          salt/fileserver/__init__.py on lines 293..300

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

          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 opts['file_ignore_regex']:
                  for regex in opts['file_ignore_regex']:
                      if re.search(regex, fname):
                          log.debug(
                              'File matching file_ignore_regex. Skipping: %s',
          Severity: Major
          Found in salt/fileserver/__init__.py and 1 other location - About 1 hr to fix
          salt/fileserver/__init__.py on lines 302..309

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

          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

              try:
                  if os.path.isdir(w_lock):
                      os.rmdir(w_lock)
                  elif os.path.isfile(w_lock):
                      os.unlink(w_lock)
          Severity: Minor
          Found in salt/fileserver/__init__.py and 1 other location - About 45 mins to fix
          salt/modules/inspectlib/collector.py on lines 267..272

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

          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