saltstack/salt

View on GitHub

Showing 17,495 of 17,590 total issues

File pip.py has 1178 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# -*- coding: utf-8 -*-
r'''
Install Python packages with pip to either the system or a virtualenv

Windows Support
Severity: Major
Found in salt/modules/pip.py - About 3 days to fix

    Function installed has a Cognitive Complexity of 149 (exceeds 5 allowed). Consider refactoring.
    Open

    def installed(name,
                  pkgs=None,
                  pip_bin=None,
                  requirements=None,
                  bin_env=None,
    Severity: Minor
    Found in salt/states/pip_state.py - About 3 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

    Function _hw_data has a Cognitive Complexity of 149 (exceeds 5 allowed). Consider refactoring.
    Open

    def _hw_data(osdata):
        '''
        Get system specific hardware data from dmidecode
    
        Provides
    Severity: Minor
    Found in salt/grains/core.py - About 3 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

    Function _format_host has a Cognitive Complexity of 149 (exceeds 5 allowed). Consider refactoring.
    Open

    def _format_host(host, data, indent_level=1):
        '''
        Main highstate formatter. can be called recursively if a nested highstate
        contains other highstates (ie in an orchestration)
        '''
    Severity: Minor
    Found in salt/output/highstate.py - About 3 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 panos.py has 1176 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    A state module to manage Palo Alto network devices.
    
    :codeauthor: ``Spencer Ervin <spencer_ervin@hotmail.com>``
    Severity: Major
    Found in salt/states/panos.py - About 3 days to fix

      File boto_elb.py has 1174 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Manage ELBs
      
      .. versionadded:: 2014.7.0
      Severity: Major
      Found in salt/states/boto_elb.py - About 3 days to fix

        File junos.py has 1174 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Module to interact with Junos devices.
        
        :maturity: new
        Severity: Major
        Found in salt/modules/junos.py - About 3 days to fix

          Function run has a Cognitive Complexity of 148 (exceeds 5 allowed). Consider refactoring.
          Open

              def run(self):
                  '''
                  Execute the batch run
                  '''
                  args = [[],
          Severity: Minor
          Found in salt/cli/batch.py - About 3 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 3 locations. Consider refactoring.
          Open

          @depends(HAS_PYVMOMI)
          @ignores_kwargs('credstore')
          def service_restart(host,
                              username,
                              password,
          Severity: Major
          Found in salt/modules/vsphere.py and 2 other locations - About 3 days to fix
          salt/modules/vsphere.py on lines 2631..2739
          salt/modules/vsphere.py on lines 2742..2850

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

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

          @depends(HAS_PYVMOMI)
          @ignores_kwargs('credstore')
          def service_stop(host,
                           username,
                           password,
          Severity: Major
          Found in salt/modules/vsphere.py and 2 other locations - About 3 days to fix
          salt/modules/vsphere.py on lines 2631..2739
          salt/modules/vsphere.py on lines 2853..2961

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

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

          @depends(HAS_PYVMOMI)
          @ignores_kwargs('credstore')
          def service_start(host,
                            username,
                            password,
          Severity: Major
          Found in salt/modules/vsphere.py and 2 other locations - About 3 days to fix
          salt/modules/vsphere.py on lines 2742..2850
          salt/modules/vsphere.py on lines 2853..2961

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

          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 neutron.py has 1168 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Module for handling OpenStack Neutron calls
          
          :depends:   - neutronclient Python module
          Severity: Major
          Found in salt/modules/neutron.py - About 3 days to fix

            File event.py has 1167 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Manage events
            
            Events are all fired off via a zeromq 'pub' socket, and listened to with local
            Severity: Major
            Found in salt/utils/event.py - About 3 days to fix

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

                  for _key in _list_keys(user, gnupghome, secret=True):
                      if (_key['fingerprint'] == fingerprint or
                              _key['keyid'] == keyid or
                              _key['keyid'][8:] == keyid):
                          tmp['keyid'] = _key['keyid']
              Severity: Major
              Found in salt/modules/gpg.py and 1 other location - About 3 days to fix
              salt/modules/gpg.py on lines 588..613

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

              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

                  for _key in _list_keys(user, gnupghome):
                      if (_key['fingerprint'] == fingerprint or
                              _key['keyid'] == keyid or
                              _key['keyid'][8:] == keyid):
                          tmp['keyid'] = _key['keyid']
              Severity: Major
              Found in salt/modules/gpg.py and 1 other location - About 3 days to fix
              salt/modules/gpg.py on lines 650..675

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

              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 dracr.py has 1166 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Manage Dell DRAC
              
              .. versionadded:: 2015.8.2
              Severity: Major
              Found in salt/modules/dracr.py - About 3 days to fix

                File fileclient.py has 1160 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                Classes that manage file clients
                '''
                from __future__ import absolute_import, print_function, unicode_literals
                Severity: Major
                Found in salt/fileclient.py - About 2 days to fix

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

                  def detached(name):
                      '''
                      Ensure zone is detached
                  
                      name : string
                  Severity: Major
                  Found in salt/states/zone.py and 1 other location - About 2 days to fix
                  salt/states/zone.py on lines 1185..1223

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

                  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 uninstalled(name):
                      '''
                      Ensure zone is uninstalled
                  
                      name : string
                  Severity: Major
                  Found in salt/states/zone.py and 1 other location - About 2 days to fix
                  salt/states/zone.py on lines 1100..1138

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

                  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

                  @depends(HAS_PYVMOMI)
                  @ignores_kwargs('credstore')
                  def get_service_policy(host, username, password, service_name, protocol=None, port=None, host_names=None):
                      '''
                      Get the service name's policy for a given host or list of hosts.
                  Severity: Major
                  Found in salt/modules/vsphere.py and 1 other location - About 2 days to fix
                  salt/modules/vsphere.py on lines 1639..1743

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

                  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