File imcsession.py
has 560 lines of code (exceeds 250 allowed). Consider refactoring. Open
# Copyright 2015 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
ImcSession
has 50 functions (exceeds 20 allowed). Consider refactoring. Open
class ImcSession(object):
"""
ImcSession class is session interface for any Imc related communication.
Parent class of ImcHandle, used internally by ImcHandle class.
"""
Function __init__
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, ip, username, password, port=None, secure=None,
Function _validate_connection
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def _validate_connection(self):
"""
Internal method to validate if needs to reconnect or if exist use the
existing connection.
"""
- 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 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def __init__(self, ip, username, password, port=None, secure=None,
proxy=None, auto_refresh=False, force=False, timeout=None):
self.__ip = ip
self.__username = username
self.__password = password
Function _set_platform
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def _set_platform(self, model=None, platform=None):
"""
Internal method to set the platform type
Not to be exposed at the handle
"""
- 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 _login
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def _login(self, auto_refresh=None, force=None, timeout=None):
"""
Internal method responsible to do a login on imc server.
Args:
- 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"