rorymurdock/WSO-UEM-Py

View on GitHub
wso/wso.py

Summary

Maintainability
B
6 hrs
Test Coverage

File wso.py has 1039 lines of code (exceeds 250 allowed). Consider refactoring.
Wontfix

"""WSO UEM package for managing large WSO instances"""
import sys
import json
import time
import logging
Severity: Major
Found in wso/wso.py - About 2 days to fix

    WSO has 66 functions (exceeds 20 allowed). Consider refactoring.
    Wontfix

    class WSO():
        """WSO API facade"""
        def __init__(self,
                     config_dir="config",
                     config_file="uem.json",
    Severity: Major
    Found in wso/wso.py - About 1 day to fix

      Function format_group_payload_devices has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
      Wontfix

          def format_group_payload_devices(self, group_name, serial_list):
              """Create a group from a list of serials"""
              self.info("args: %s" % self.filter_locals(locals()))
      
              payload = {}
      Severity: Minor
      Found in wso/wso.py - About 2 hrs 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 get_all_devices has 12 arguments (exceeds 4 allowed). Consider refactoring.
      Wontfix

          def get_all_devices(self,
      Severity: Major
      Found in wso/wso.py - About 1 hr to fix

        Function get_device_extensive has 12 arguments (exceeds 4 allowed). Consider refactoring.
        Wontfix

            def get_device_extensive(self,
        Severity: Major
        Found in wso/wso.py - About 1 hr to fix

          Function create_og has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
          Open

              def create_og(self,
                            parentog_id: int,
                            payload=dict,
                            strict_name=True,
                            strict_group_id=True):
          Severity: Minor
          Found in wso/wso.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 xctivate_product has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Wontfix

              def xctivate_product(self, action: str, product_id: int, skip_check: bool):
                  """Activates or Deactivates a product based on ID, returns Bool"""
                  self.info("args: %s" % self.filter_locals(locals()))
          
                  product = self.get_product(product_id)
          Severity: Minor
          Found in wso/wso.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 format_og_payload has 9 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def format_og_payload(self,
          Severity: Major
          Found in wso/wso.py - About 1 hr to fix

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

                def find_admin(self,
            Severity: Major
            Found in wso/wso.py - About 1 hr to fix

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

                  def get_user(self,
              Severity: Major
              Found in wso/wso.py - About 1 hr to fix

                Function get_device has 8 arguments (exceeds 4 allowed). Consider refactoring.
                Wontfix

                    def get_device(self,
                Severity: Major
                Found in wso/wso.py - About 1 hr to fix

                  Function simple_get has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Wontfix

                      def simple_get(self, path, querystring=None, version=2):
                          """Simple HTTP get given a path"""
                          # If the args are too large don't display in the logger
                          if sys.getsizeof(self.filter_locals(locals())) > self.max_log:
                              self.info("args exceed max display size %s" %
                  Severity: Minor
                  Found in wso/wso.py - About 55 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 format_og_payload has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def format_og_payload(self,
                                            name: str,
                                            group_id: str,
                                            location_group_type,
                                            country=None,
                  Severity: Minor
                  Found in wso/wso.py - About 55 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 create_product has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Wontfix

                      def create_product(self,
                  Severity: Minor
                  Found in wso/wso.py - About 45 mins to fix

                    Function assign_group_to_product has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                    Wontfix

                        def assign_group_to_product(self, product_id: int, group_id: int):
                            """Assigns a group to a product"""
                            self.info("args: %s" % self.filter_locals(locals()))
                            # Get product current assignments
                            # Check group is not already assigned
                    Severity: Minor
                    Found in wso/wso.py - About 45 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 move_og has 5 arguments (exceeds 4 allowed). Consider refactoring.
                    Wontfix

                        def move_og(self,
                    Severity: Minor
                    Found in wso/wso.py - About 35 mins to fix

                      Function get_user has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def get_user(self,
                                       firstname=None,
                                       lastname=None,
                                       email=None,
                                       locationgroupId=None,
                      Severity: Minor
                      Found in wso/wso.py - About 35 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 __init__ has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Open

                          def __init__(self,
                                       config_dir="config",
                                       config_file="uem.json",
                                       debug=False,
                                       bulk_query_trigger=50):
                      Severity: Minor
                      Found in wso/wso.py - About 35 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 create_product has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                      Wontfix

                          def create_product(self,
                                             name,
                                             description,
                                             action_type_id,
                                             action_item_id,
                      Severity: Minor
                      Found in wso/wso.py - About 35 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

                      Avoid too many return statements within this function.
                      Wontfix

                              return self.check_http_response(response)
                      Severity: Major
                      Found in wso/wso.py - About 30 mins to fix

                        Function remove_all_groups_from_product has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Wontfix

                            def remove_all_groups_from_product(self, product_id):
                                """Remove all assigned groups from products"""
                                self.info("args: %s" % self.filter_locals(locals()))
                        
                                product_name = self.get_product_name(product_id)
                        Severity: Minor
                        Found in wso/wso.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 delete_product has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                        Wontfix

                            def delete_product(self, product_id):
                                """Delete a product based on ID"""
                                self.info("args: %s" % self.filter_locals(locals()))
                        
                                product_name = self.get_product_name(product_id)
                        Severity: Minor
                        Found in wso/wso.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

                        There are no issues that match your filters.

                        Category
                        Status