CiscoUcs/imcsdk

View on GitHub
imcsdk/apis/v2/storage/controller.py

Summary

Maintainability
F
5 days
Test Coverage

File controller.py has 434 lines of code (exceeds 250 allowed). Consider refactoring.
Open

# Copyright 2017 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/v2/storage/controller.py - About 6 hrs to fix

    Function controller_encryption_enable has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

    def controller_encryption_enable(handle, controller_type, controller_slot,
    Severity: Major
    Found in imcsdk/apis/v2/storage/controller.py - About 1 hr to fix

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

      def controller_action_exists(handle, controller_type, controller_slot,
      Severity: Minor
      Found in imcsdk/apis/v2/storage/controller.py - About 35 mins to fix

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

        def controller_action_apply(handle, controller_type, controller_slot,
        Severity: Minor
        Found in imcsdk/apis/v2/storage/controller.py - About 35 mins to fix

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

          def controller_unlock_foreign_drives(handle, controller_type,
          Severity: Minor
          Found in imcsdk/apis/v2/storage/controller.py - About 35 mins to fix

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

            def controller_encryption_exists(handle, controller_type, controller_slot,
            Severity: Minor
            Found in imcsdk/apis/v2/storage/controller.py - About 35 mins to fix

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

              def _controller_action_set(handle, controller_type, controller_slot, action,
              Severity: Minor
              Found in imcsdk/apis/v2/storage/controller.py - About 35 mins to fix

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

                def controller_action_apply(handle, controller_type, controller_slot,
                                            action, server_id=1):
                    """
                    Applies the controller action.
                
                
                Severity: Major
                Found in imcsdk/apis/v2/storage/controller.py and 1 other location - About 6 hrs to fix
                imcsdk/apis/v2/storage/controller.py on lines 507..546

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

                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 controller_action_exists(handle, controller_type, controller_slot,
                                             action, server_id=1):
                    """
                    Check if action is already applied on controller.
                
                
                Severity: Major
                Found in imcsdk/apis/v2/storage/controller.py and 1 other location - About 6 hrs to fix
                imcsdk/apis/v2/storage/controller.py on lines 465..504

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

                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 controller_encryption_disable(handle, controller_type,
                                                  controller_slot, server_id=1):
                    """
                    Disables encryption on the controller
                
                
                Severity: Major
                Found in imcsdk/apis/v2/storage/controller.py and 2 other locations - About 3 hrs to fix
                imcsdk/apis/server/storage.py on lines 550..581
                imcsdk/apis/v2/server/storage.py on lines 550..581

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

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

                def controller_encryption_key_id_generate(handle, controller_type,
                                                          controller_slot, server_id=1):
                    """
                    Generates a random key id for the given controller
                
                
                Severity: Major
                Found in imcsdk/apis/v2/storage/controller.py and 5 other locations - About 2 hrs to fix
                imcsdk/apis/server/storage.py on lines 660..686
                imcsdk/apis/server/storage.py on lines 689..715
                imcsdk/apis/v2/server/storage.py on lines 660..686
                imcsdk/apis/v2/server/storage.py on lines 689..715
                imcsdk/apis/v2/storage/controller.py on lines 308..335

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

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

                def controller_encryption_key_generate(handle, controller_type,
                                                       controller_slot, server_id=1):
                    """
                    Generates a random security key for the given controller
                
                
                Severity: Major
                Found in imcsdk/apis/v2/storage/controller.py and 5 other locations - About 2 hrs to fix
                imcsdk/apis/server/storage.py on lines 660..686
                imcsdk/apis/server/storage.py on lines 689..715
                imcsdk/apis/v2/server/storage.py on lines 660..686
                imcsdk/apis/v2/server/storage.py on lines 689..715
                imcsdk/apis/v2/storage/controller.py on lines 278..305

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

                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 _get_controller(handle, controller_type, controller_slot, server_id=1):
                    mo = handle.query_dn(_get_controller_dn(handle,
                                                            controller_type,
                                                            controller_slot,
                                                            server_id))
                Severity: Major
                Found in imcsdk/apis/v2/storage/controller.py and 2 other locations - About 2 hrs to fix
                imcsdk/apis/server/storage.py on lines 181..190
                imcsdk/apis/v2/server/storage.py on lines 181..190

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

                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 _get_controller_dn(handle, controller_type, controller_slot, server_id=1):
                    dn = imccoreutils.get_server_dn(handle, server_id)
                    return dn + "/board/storage-" + controller_type + "-" + controller_slot
                Severity: Major
                Found in imcsdk/apis/v2/storage/controller.py and 2 other locations - About 2 hrs to fix
                imcsdk/apis/server/storage.py on lines 176..178
                imcsdk/apis/v2/server/storage.py on lines 176..178

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

                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 controller_jbod_disable(handle, controller_type, controller_slot,
                                            server_id=1):
                    """
                    Disables jbod mode on the controller
                
                
                Severity: Major
                Found in imcsdk/apis/v2/storage/controller.py and 1 other location - About 1 hr to fix
                imcsdk/apis/v2/storage/controller.py on lines 55..77

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

                def controller_jbod_enable(handle, controller_type, controller_slot,
                                           server_id=1):
                    """
                    Enables jbod mode on the controller
                
                
                Severity: Major
                Found in imcsdk/apis/v2/storage/controller.py and 1 other location - About 1 hr to fix
                imcsdk/apis/v2/storage/controller.py on lines 114..136

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

                def controller_import_foreign_config(handle, controller_type,
                                                     controller_slot, server_id=1):
                    """
                    Imports foreign configuration on the given controller
                
                
                Severity: Minor
                Found in imcsdk/apis/v2/storage/controller.py and 1 other location - About 55 mins to fix
                imcsdk/apis/v2/storage/controller.py on lines 406..430

                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 controller_clear_boot_drive(handle, controller_type, controller_slot,
                                                server_id=1):
                    """
                    Clears boot drive
                
                
                Severity: Minor
                Found in imcsdk/apis/v2/storage/controller.py and 1 other location - About 55 mins to fix
                imcsdk/apis/v2/storage/controller.py on lines 376..401

                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

                There are no issues that match your filters.

                Category
                Status