saltstack/salt

View on GitHub

Showing 17,495 of 17,590 total issues

File win_dacl.py has 1940 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
'''
============
Windows DACL
============
Severity: Major
Found in salt/utils/win_dacl.py - About 5 days to fix

    File consul.py has 1920 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Interact with Consul
    
    https://www.consul.io
    Severity: Major
    Found in salt/modules/consul.py - About 5 days to fix

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

      Severity: Major
      Found in salt/states/postgres_default_privileges.py and 1 other location - About 5 days to fix
      salt/states/postgres_privileges.py on lines 0..320

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

      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

      Severity: Major
      Found in salt/states/postgres_privileges.py and 1 other location - About 5 days to fix
      salt/states/postgres_default_privileges.py on lines 0..315

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

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

      def present(name,
                  uid=None,
                  gid=None,
                  usergroup=None,
                  groups=None,
      Severity: Minor
      Found in salt/states/user.py - About 5 days 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

      File master.py has 1891 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      This module contains all of the routines needed to set up a master server, this
      involves preparing the three listeners and the workers needed by the master.
      '''
      Severity: Major
      Found in salt/master.py - About 5 days to fix

        File state.py has 1879 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Control the state system on the minion.
        
        State Caching
        Severity: Major
        Found in salt/modules/state.py - About 5 days to fix

          File boto_iam.py has 1858 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Connection module for Amazon IAM
          
          .. versionadded:: 2014.7.0
          Severity: Major
          Found in salt/modules/boto_iam.py - About 5 days to fix

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

            def _atq(**kwargs):
                '''
                Return match jobs list
                '''
            
            
            Severity: Major
            Found in salt/modules/at.py and 1 other location - About 5 days to fix
            salt/modules/at_solaris.py on lines 238..316

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

            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

            def _atq(**kwargs):
                '''
                Return match jobs list
                '''
            
            
            Severity: Major
            Found in salt/modules/at_solaris.py and 1 other location - About 5 days to fix
            salt/modules/at.py on lines 290..368

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

            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

            File mysql.py has 1833 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Module to provide MySQL compatibility to salt.
            
            :depends:   - MySQLdb Python module
            Severity: Major
            Found in salt/modules/mysql.py - About 5 days to fix

              Function _run has a Cognitive Complexity of 238 (exceeds 5 allowed). Consider refactoring.
              Open

              def _run(cmd,
                       cwd=None,
                       stdin=None,
                       stdout=subprocess.PIPE,
                       stderr=subprocess.PIPE,
              Severity: Minor
              Found in salt/modules/cmdmod.py - About 4 days 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

              File win_task.py has 1793 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              # https://msdn.microsoft.com/en-us/library/windows/desktop/aa383608(v=vs.85).aspx
              '''
              Windows Task Scheduler Module
              .. versionadded:: 2016.3.0
              Severity: Major
              Found in salt/modules/win_task.py - About 4 days to fix

                File azurearm.py has 1781 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                Azure ARM Cloud Module
                ======================
                
                
                Severity: Major
                Found in salt/cloud/clouds/azurearm.py - About 4 days to fix

                  File boto_ec2.py has 1757 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  '''
                  Connection module for Amazon EC2
                  
                  .. versionadded:: 2015.8.0
                  Severity: Major
                  Found in salt/modules/boto_ec2.py - About 4 days to fix

                    File pkgng.py has 1755 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    '''
                    Support for ``pkgng``, the new package manager for FreeBSD
                    
                    .. important::
                    Severity: Major
                    Found in salt/modules/pkgng.py - About 4 days to fix

                      Function check_perms has a Cognitive Complexity of 229 (exceeds 5 allowed). Consider refactoring.
                      Open

                      def check_perms(name, ret, user, group, mode, attrs=None, follow_symlinks=False, seuser=None,
                                      serole=None, setype=None, serange=None):
                          '''
                          .. versionchanged:: Neon
                      
                      
                      Severity: Minor
                      Found in salt/modules/file.py - About 4 days 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

                          if policies_to_attach or policies_to_detach:
                              _to_modify = list(policies_to_detach)
                              _to_modify.extend(policies_to_attach)
                              if __opts__['test']:
                                  ret['comment'] = '{0} policies to be modified on user {1}.'.format(', '.join(_to_modify), name)
                      Severity: Major
                      Found in salt/states/boto_iam.py and 1 other location - About 4 days to fix
                      salt/states/boto_iam.py on lines 1109..1152

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

                      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 policies_to_attach or policies_to_detach:
                              _to_modify = list(policies_to_detach)
                              _to_modify.extend(policies_to_attach)
                              if __opts__['test']:
                                  ret['comment'] = '{0} policies to be modified on group {1}.'.format(', '.join(_to_modify), name)
                      Severity: Major
                      Found in salt/states/boto_iam.py and 1 other location - About 4 days to fix
                      salt/states/boto_iam.py on lines 660..706

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

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

                          if output == 'grain':
                              if grain is not None and key is None:
                                  if not overwrite and grain in __salt__['grains.ls']():
                                      ret['comment'] = 'No execution needed. Grain ' + grain\
                                                     + ' already set'
                      Severity: Major
                      Found in salt/states/mysql_query.py and 1 other location - About 4 days to fix
                      salt/states/mysql_query.py on lines 283..326

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

                      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

                      Severity
                      Category
                      Status
                      Source
                      Language