saltstack/salt

View on GitHub

Showing 22,780 of 22,834 total issues

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

Severity: Major
Found in tests/unit/pillar/test_sqlcipher.py and 1 other location - About 1 mo to fix
tests/unit/pillar/test_sqlite3.py on lines 0..559

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

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 tests/unit/pillar/test_sqlite3.py and 1 other location - About 1 mo to fix
tests/unit/pillar/test_sqlcipher.py on lines 0..559

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

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

# -*- coding: utf-8 -*-
'''
Operations on regular files, special files, directories, and symlinks
=====================================================================

Severity: Major
Found in salt/states/file.py - About 2 wks to fix

    File jquery-1.9.1.js has 6570 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /*!
     * jQuery JavaScript Library v1.9.1
     * http://jquery.com/
     *
     * Includes Sizzle.js
    Severity: Major
    Found in doc/_themes/saltstack/static/js/vendor/jquery-1.9.1.js - About 2 wks to fix

      File dockermod.py has 5276 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Management of Docker Containers
      
      .. versionadded:: 2015.8.0
      Severity: Major
      Found in salt/modules/dockermod.py - About 2 wks to fix

        File file.py has 5167 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Manage information about regular files, directories,
        and special files on the minion, set/read user,
        group, mode, and data
        Severity: Major
        Found in salt/modules/file.py - About 2 wks to fix

          Function latest has a Cognitive Complexity of 670 (exceeds 5 allowed). Consider refactoring.
          Open

          def latest(name,
                     rev='HEAD',
                     target=None,
                     branch=None,
                     user=None,
          Severity: Minor
          Found in salt/states/git.py - About 1 wk 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 git.py has 4187 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          # -*- coding: utf-8 -*-
          '''
          Support for the Git SCM
          '''
          from __future__ import absolute_import, print_function, unicode_literals
          Severity: Major
          Found in salt/modules/git.py - About 1 wk to fix

            File ec2.py has 4122 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            The EC2 Cloud Module
            ====================
            
            
            Severity: Major
            Found in salt/cloud/clouds/ec2.py - About 1 wk to fix

              File virt.py has 4059 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              # -*- coding: utf-8 -*-
              '''
              Work with virtual machines managed by libvirt
              
              :depends: libvirt Python module
              Severity: Major
              Found in salt/modules/virt.py - About 1 wk to fix

                File test_vmware.py has 4035 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                :codeauthor: Alexandru Bleotu <alexandru.bleotu@morganstanley.com>
                
                Tests for cluster related functions in salt.utils.vmware
                Severity: Major
                Found in tests/unit/utils/test_vmware.py - About 1 wk to fix

                  File test_file.py has 3947 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  # -*- coding: utf-8 -*-
                  
                  '''
                  Tests for the file state
                  '''
                  Severity: Major
                  Found in tests/integration/states/test_file.py - About 1 wk to fix

                    Function requisite_in has a Cognitive Complexity of 534 (exceeds 5 allowed). Consider refactoring.
                    Open

                        def requisite_in(self, high):
                            '''
                            Extend the data reference with requisite_in arguments
                            '''
                            req_in = {'require_in', 'watch_in', 'onfail_in', 'onchanges_in', 'use', 'use_in', 'prereq', 'prereq_in'}
                    Severity: Minor
                    Found in salt/state.py - About 1 wk 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 state.py has 3798 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    # -*- coding: utf-8 -*-
                    '''
                    The State Compiler is used to execute states in Salt. A state is unlike
                    an execution module in that instead of just executing a command, it
                    ensures that a certain state is present on the system.
                    Severity: Major
                    Found in salt/state.py - About 1 wk to fix

                      File lxc.py has 3760 lines of code (exceeds 250 allowed). Consider refactoring.
                      Open

                      # -*- coding: utf-8 -*-
                      '''
                      Control Linux Containers via Salt
                      
                      :depends: lxc package for distribution
                      Severity: Major
                      Found in salt/modules/lxc.py - About 1 wk to fix

                        Function _checkAllAdmxPolicies has a Cognitive Complexity of 519 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def _checkAllAdmxPolicies(policy_class,
                                                  adml_language='en-US',
                                                  return_full_policy_names=False,
                                                  hierarchical_return=False,
                                                  return_not_configured=False):
                        Severity: Minor
                        Found in salt/modules/win_lgpo.py - About 1 wk 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

                        Severity: Major
                        Found in tests/unit/states/test_postgres_privileges.py and 1 other location - About 1 wk to fix
                        tests/unit/states/test_postgres_default_privileges.py on lines 0..174

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

                        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 tests/unit/states/test_postgres_default_privileges.py and 1 other location - About 1 wk to fix
                        tests/unit/states/test_postgres_privileges.py on lines 0..173

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

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

                        def set_(computer_policy=None,
                                 user_policy=None,
                                 cumulative_rights_assignments=True,
                                 adml_language='en-US'):
                            '''
                        Severity: Minor
                        Found in salt/modules/win_lgpo.py - About 1 wk 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

                        @skipIf(NO_MOCK, NO_MOCK_REASON)
                        class ZabbixActionTestCase(TestCase, LoaderModuleMockMixin):
                            '''
                            Test cases for salt.modules.zabbix
                            '''
                        Severity: Major
                        Found in tests/unit/states/test_zabbix_action.py and 1 other location - About 1 wk to fix
                        tests/unit/states/test_zabbix_valuemap.py on lines 37..152

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

                        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