CiscoUcs/imcsdk

View on GitHub
imcsdk/apis/admin/ldap.py

Summary

Maintainability
F
1 wk
Test Coverage

File ldap.py has 443 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2016 Cisco Systems, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
Severity: Minor
Found in imcsdk/apis/admin/ldap.py - About 6 hrs to fix

    Function ldap_enable has 21 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def ldap_enable(handle,
    Severity: Major
    Found in imcsdk/apis/admin/ldap.py - About 2 hrs to fix

      Function _prepare_ldap_servers has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

      def _prepare_ldap_servers(ldap_servers):
          if len(ldap_servers) > len(_LDAP_SERVERS):
              raise ImcOperationError("Configure LDAP", "Cannot configure more than"
                                      "%d servers" % len(_LDAP_SERVERS))
          servers = {}
      Severity: Minor
      Found in imcsdk/apis/admin/ldap.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 ldap_certificate_download has 7 arguments (exceeds 4 allowed). Consider refactoring.
      Open

      def ldap_certificate_download(handle, remote_server, remote_file,
      Severity: Major
      Found in imcsdk/apis/admin/ldap.py - About 50 mins to fix

        Function ldap_certificate_export has 7 arguments (exceeds 4 allowed). Consider refactoring.
        Open

        def ldap_certificate_export(handle, remote_server, remote_file,
        Severity: Major
        Found in imcsdk/apis/admin/ldap.py - About 50 mins to fix

          Function ldap_role_group_create has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

          def ldap_role_group_create(handle, domain, name, role='read-only', **kwargs):
          Severity: Minor
          Found in imcsdk/apis/admin/ldap.py - About 35 mins to fix

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

            def _check_ldap_server_match(ldap_mo, ldap_servers):
                servers, ports = _prepare_ldap_servers(ldap_servers)
            
                for server in servers:
                    if servers[server] != getattr(ldap_mo, server):
            Severity: Minor
            Found in imcsdk/apis/admin/ldap.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

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

            def ldap_exists(handle, change_password=False, **kwargs):
                """
                Checks if the specified LDAP settings are already applied
            
                Args:
            Severity: Minor
            Found in imcsdk/apis/admin/ldap.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

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

            def _prepare_ldap_servers(ldap_servers):
                if len(ldap_servers) > len(_LDAP_SERVERS):
                    raise ImcOperationError("Configure LDAP", "Cannot configure more than"
                                            "%d servers" % len(_LDAP_SERVERS))
                servers = {}
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 1 day to fix
            imcsdk/apis/v2/admin/ldap.py on lines 39..59

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

            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 ldap_certificate_download(handle, remote_server, remote_file,
                                          user=None, pwd=None, protocol='tftp', **kwargs):
                """
                Download LDAP CA certificate from remote server to Cisco IMC
            
            
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 3 other locations - About 5 hrs to fix
            imcsdk/apis/admin/ldap.py on lines 489..522
            imcsdk/apis/v2/admin/ldap.py on lines 640..674
            imcsdk/apis/v2/admin/ldap.py on lines 677..711

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

            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 ldap_certificate_export(handle, remote_server, remote_file,
                                        user=None, pwd=None, protocol='tftp', **kwargs):
                """
                Export the LDAP CA certificate from the Cisco IMC to a remote location
            
            
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 3 other locations - About 5 hrs to fix
            imcsdk/apis/admin/ldap.py on lines 453..486
            imcsdk/apis/v2/admin/ldap.py on lines 640..674
            imcsdk/apis/v2/admin/ldap.py on lines 677..711

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

            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 _check_ldap_server_match(ldap_mo, ldap_servers):
                servers, ports = _prepare_ldap_servers(ldap_servers)
            
                for server in servers:
                    if servers[server] != getattr(ldap_mo, server):
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 4 hrs to fix
            imcsdk/apis/v2/admin/ldap.py on lines 190..201

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

            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 ldap_certificate_binding_check(handle, user=None, pwd=None, **kwargs):
                """
                Tests the LDAP CA certificate binding
            
                Args:
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 4 hrs to fix
            imcsdk/apis/v2/admin/ldap.py on lines 714..738

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

            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 _get_free_ldap_role_group_id(handle):
                mos = handle.query_classid('AaaLdapRoleGroup')
                for mo in mos:
                    if not mo.name and not mo.domain:
                        return mo.id
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 2 hrs to fix
            imcsdk/apis/v2/admin/ldap.py on lines 287..294

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

            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 ldap_role_group_get(handle, domain, name, **kwargs):
                """
                Gets the ldap role group based on domain and name
            
                Args:
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 2 hrs to fix
            imcsdk/apis/v2/admin/ldap.py on lines 337..359

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

            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 ldap_certificate_management_enable(handle):
                """
                Enables ldap certificate management
            
                Args:
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 3 other locations - About 1 hr to fix
            imcsdk/apis/admin/ldap.py on lines 423..436
            imcsdk/apis/admin/ldap.py on lines 552..570
            imcsdk/apis/v2/admin/ldap.py on lines 741..759

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

            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 ldap_certificate_management_disable(handle):
                """
                Disables ldap certificate management
            
                Args:
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 3 other locations - About 1 hr to fix
            imcsdk/apis/admin/ldap.py on lines 407..420
            imcsdk/apis/admin/ldap.py on lines 552..570
            imcsdk/apis/v2/admin/ldap.py on lines 741..759

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

            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 ldap_certificate_delete(handle):
                """
                Deletes the LDAP CA certificate
            
                Args:
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 3 other locations - About 1 hr to fix
            imcsdk/apis/admin/ldap.py on lines 407..420
            imcsdk/apis/admin/ldap.py on lines 423..436
            imcsdk/apis/v2/admin/ldap.py on lines 741..759

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

            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 ldap_enable(handle,
                            basedn=None,
                            domain=None,
                            encryption=None,
                            timeout=None,
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 1 hr to fix
            imcsdk/apis/v2/admin/ldap.py on lines 68..87

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

            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

            def ldap_disable(handle):
                """
                Disables the ldap settings
            
                Args:
            Severity: Major
            Found in imcsdk/apis/admin/ldap.py and 2 other locations - About 1 hr to fix
            imcsdk/apis/v2/admin/ldap.py on lines 249..266
            imcsdk/apis/v2/admin/smtp.py on lines 106..122

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

            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 is_ldap_enabled(handle):
                """
                Checks if LDAP is enabled
            
                Args:
            Severity: Minor
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 55 mins to fix
            imcsdk/apis/v2/admin/ldap.py on lines 269..284

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

            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 _set_ldap_servers(mo, ldap_servers):
                servers, ports = _prepare_ldap_servers(ldap_servers)
                mo.set_prop_multiple(**servers)
                mo.set_prop_multiple(**ports)
            Severity: Minor
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 55 mins to fix
            imcsdk/apis/v2/admin/ldap.py on lines 62..65

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

            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 is_ldap_certificate_management_enabled(handle):
                """
                Checks if LDAP certificate management is enabled
            
                Args:
            Severity: Minor
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 55 mins to fix
            imcsdk/apis/v2/admin/ldap.py on lines 626..637

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

            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 _check_match(prop1, prop2):
                if _is_invalid_value(prop1) and _is_invalid_value(prop2):
                    return None
                return prop1 == prop2
            Severity: Minor
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 50 mins to fix
            imcsdk/apis/v2/admin/ldap.py on lines 184..187

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

            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 _is_valid_arg('ldap_servers', kwargs):
                    if not _check_ldap_server_match(mo, kwargs.pop('ldap_servers')):
                        return False, None
            Severity: Minor
            Found in imcsdk/apis/admin/ldap.py and 1 other location - About 40 mins to fix
            imcsdk/apis/v2/admin/ldap.py on lines 229..231

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

            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