saltstack/salt

View on GitHub

Showing 17,495 of 17,590 total issues

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

def _user_policies_deleted(
        name,
        region=None,
        key=None,
        keyid=None,
Severity: Major
Found in salt/states/boto_iam.py and 1 other location - About 3 days to fix
salt/states/boto_iam.py on lines 1197..1232

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

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

# encoding: utf-8
'''
A non-blocking REST API for Salt
================================

Severity: Major
Found in salt/netapi/rest_tornado/saltnado.py - About 3 days to fix

    File opkg.py has 1276 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    # -*- coding: utf-8 -*-
    '''
    Support for Opkg
    
    .. important::
    Severity: Major
    Found in salt/modules/opkg.py - About 3 days to fix

      File archive.py has 1275 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      # -*- coding: utf-8 -*-
      '''
      Extract an archive
      
      .. versionadded:: 2014.1.0
      Severity: Major
      Found in salt/states/archive.py - About 3 days to fix

        Function mksls has a Cognitive Complexity of 163 (exceeds 5 allowed). Consider refactoring.
        Open

        def mksls(src, dst=None):
            '''
            Convert a kickstart file to an SLS file
            '''
            mode = 'command'
        Severity: Minor
        Found in salt/utils/kickstart.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 linode.py has 1268 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        # -*- coding: utf-8 -*-
        '''
        Linode Cloud Module using Linode's REST API
        ===========================================
        
        
        Severity: Major
        Found in salt/cloud/clouds/linode.py - About 3 days to fix

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

          def has_default_privileges(name,
                  object_name,
                  object_type,
                  defprivileges=None,
                  grant_option=None,
          Severity: Major
          Found in salt/modules/postgres.py and 1 other location - About 3 days to fix
          salt/modules/postgres.py on lines 3074..3194

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

          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 has_privileges(name,
                  object_name,
                  object_type,
                  privileges=None,
                  grant_option=None,
          Severity: Major
          Found in salt/modules/postgres.py and 1 other location - About 3 days to fix
          salt/modules/postgres.py on lines 2956..3071

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

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

          # -*- coding: utf-8 -*-
          '''
          The crypt module manages all of the cryptography functions for minions and
          masters, encrypting and decrypting payloads, preparing messages, and
          authenticating peers
          Severity: Major
          Found in salt/crypt.py - About 3 days to fix

            Function mod_repo has a Cognitive Complexity of 160 (exceeds 5 allowed). Consider refactoring.
            Open

            def mod_repo(repo, saltenv='base', **kwargs):
                '''
                Modify one or more values for a repo.  If the repo does not exist, it will
                be created, so long as the definition is well formed.  For Ubuntu the
                ``ppa:<project>/repo`` format is acceptable. ``ppa:`` format can only be
            Severity: Minor
            Found in salt/modules/aptpkg.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 win_file.py has 1240 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            # -*- coding: utf-8 -*-
            '''
            Manage information about files on the minion, set/read user, group
            data, modify the ACL of files/directories
            
            
            Severity: Major
            Found in salt/modules/win_file.py - About 3 days to fix

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

              def absent(name, Name,
                                region=None, key=None, keyid=None, profile=None):
                  '''
                  Ensure trail with passed properties is absent.
              
              
              Severity: Major
              Found in salt/states/boto_cloudtrail.py and 3 other locations - About 3 days to fix
              salt/states/boto_elasticsearch_domain.py on lines 328..385
              salt/states/boto_iot.py on lines 749..805
              salt/states/boto_lambda.py on lines 511..569

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

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

              def topic_rule_absent(name, ruleName,
                                region=None, key=None, keyid=None, profile=None):
                  '''
                  Ensure topic rule with passed properties is absent.
              
              
              Severity: Major
              Found in salt/states/boto_iot.py and 3 other locations - About 3 days to fix
              salt/states/boto_cloudtrail.py on lines 318..374
              salt/states/boto_elasticsearch_domain.py on lines 328..385
              salt/states/boto_lambda.py on lines 511..569

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

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

              def absent(name, DomainName,
                                region=None, key=None, keyid=None, profile=None):
                  '''
                  Ensure domain with passed properties is absent.
              
              
              Severity: Major
              Found in salt/states/boto_elasticsearch_domain.py and 3 other locations - About 3 days to fix
              salt/states/boto_cloudtrail.py on lines 318..374
              salt/states/boto_iot.py on lines 749..805
              salt/states/boto_lambda.py on lines 511..569

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

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

              def function_absent(name, FunctionName, region=None, key=None, keyid=None, profile=None):
                  '''
                  Ensure function with passed properties is absent.
              
                  name
              Severity: Major
              Found in salt/states/boto_lambda.py and 3 other locations - About 3 days to fix
              salt/states/boto_cloudtrail.py on lines 318..374
              salt/states/boto_elasticsearch_domain.py on lines 328..385
              salt/states/boto_iot.py on lines 749..805

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

              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 _parse_settings_bond_2(opts, iface, bond_def):
                  '''
                  Filters given options and outputs valid settings for bond2.
                  If an option has a value that is not expected, this
                  function will log what the Interface, Setting and what it was
              Severity: Major
              Found in salt/modules/rh_ip.py and 1 other location - About 3 days to fix
              salt/modules/debian_ip.py on lines 918..962

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

              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 _parse_settings_bond_2(opts, iface, bond_def):
                  '''
                  Filters given options and outputs valid settings for bond2.
                  If an option has a value that is not expected, this
                  function will log what the Interface, Setting and what it was
              Severity: Major
              Found in salt/modules/debian_ip.py and 1 other location - About 3 days to fix
              salt/modules/rh_ip.py on lines 359..403

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

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

              # -*- coding: utf-8 -*-
              '''
              Support for iptables
              
              Configuration Options
              Severity: Major
              Found in salt/modules/iptables.py - About 3 days to fix

                File schema.py has 1233 lines of code (exceeds 250 allowed). Consider refactoring.
                Open

                # -*- coding: utf-8 -*-
                '''
                    :codeauthor: Pedro Algarvio (pedro@algarvio.me)
                    :codeauthor: Alexandru Bleotu (alexandru.bleotu@morganstanley.com)
                
                
                Severity: Major
                Found in salt/utils/schema.py - About 3 days to fix

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

                  def service_group_exists(name,
                                           groupname=None,
                                           vsys=1,
                                           members=None,
                                           description=None,
                  Severity: Major
                  Found in salt/states/panos.py and 1 other location - About 3 days to fix
                  salt/states/panos.py on lines 427..530

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

                  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