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
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",
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 = {}
- Read upRead up
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,
Function get_device_extensive
has 12 arguments (exceeds 4 allowed). Consider refactoring. Wontfix
def get_device_extensive(self,
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):
- Read upRead up
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)
- Read upRead up
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,
Function find_admin
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def find_admin(self,
Function get_user
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def get_user(self,
Function get_device
has 8 arguments (exceeds 4 allowed). Consider refactoring. Wontfix
def get_device(self,
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" %
- Read upRead up
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,
- Read upRead up
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,
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
- Read upRead up
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,
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,
- Read upRead up
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):
- Read upRead up
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,
- Read upRead up
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)
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)
- Read upRead up
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)
- Read upRead up
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"