Function get_installed_package
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
def get_installed_package(target_host_ip, command, target_host_os):
delete_user_machine_packages(target_host_ip)
a= AnsibleV1Inv.get_inv()
packages = RunTask(target_host_ip, command,"shell",a)
if target_host_os == 'Ubuntu':
File PackageListUpdate.py
has 337 lines of code (exceeds 250 allowed). Consider refactoring.
Function get_all_package
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
def get_all_package(target_host_ip, command, target_host_os):
delete_repository_package_db(target_host_ip)
a= AnsibleV1Inv.get_inv()
packages = RunTask(target_host_ip, command,"shell",a)
if target_host_os == 'Ubuntu':
Function package_update
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
def package_update(targetHost, os, command):
if os == 'Raspbian':
os = 'Ubuntu'
print (
'\n------------------------------------' + targetHost
Function update_installed_package_db
has 5 arguments (exceeds 4 allowed). Consider refactoring.
def update_installed_package_db(package_name,package_version,package_summary,
Function update_repository_package_db
has 5 arguments (exceeds 4 allowed). Consider refactoring.
def update_repository_package_db(package_name,package_version,package_summary,
Identical blocks of code found in 2 locations. Consider refactoring.
elif target_host_os == 'Gentoo':
package_line = packages['contacted'][target_host_ip]['stdout']
package_list = package_line.split('\n')
for package in package_list:
category_name_version = package.split(' ')
Identical blocks of code found in 2 locations. Consider refactoring.
elif target_host_os == 'Gentoo':
try:
package_line = packages['contacted'][target_host_ip]['stdout']
except Exception, error:
print error
Similar blocks of code found in 2 locations. Consider refactoring.
for package in package_list:
category_name_version = package.split(' ')
package_category = category_name_version[0]
package_name = category_name_version[1]
packge_version = category_name_version[2]
Similar blocks of code found in 2 locations. Consider refactoring.
for package in package_list:
category_name_version = package.split(' ')
package_category = category_name_version[0]
package_name = category_name_version[1]
packge_version = category_name_version[2]
Similar blocks of code found in 2 locations. Consider refactoring.
def repository_installed(os):
print os
if os == 'Ubuntu' or os == 'Raspbian':
command = "dpkg -l | awk 'NR>5{print $0}'"
elif os == 'Gentoo':
Similar blocks of code found in 2 locations. Consider refactoring.
def repository_all(os):
print os
if os == 'Ubuntu' or os == 'Raspbian':
command = "apt-cache search ."
elif os == 'Gentoo':
Similar blocks of code found in 3 locations. Consider refactoring.
try:
thr = Thread(target=get_installed_package, args=[targetHost, command_installed, os])
thr.start()
except Exception as e:
print(traceback.format_exc())
Similar blocks of code found in 3 locations. Consider refactoring.
try:
thr1 = Thread(target=get_all_package, args=[targetHost, command_all, os])
thr1.start()
except Exception as e:
print(traceback.format_exc())
Similar blocks of code found in 3 locations. Consider refactoring.
if command == 'respository':
try:
thr1 = Thread(target=get_all_package, args=[targetHost, command_all, os])
thr1.start()
except Exception as e:
Similar blocks of code found in 2 locations. Consider refactoring.
try:
dpkg_lines = packages['contacted'][target_host_ip]['stdout']
except Exception, error:
print error
pass
Similar blocks of code found in 2 locations. Consider refactoring.
try:
package_line = packages['contacted'][target_host_ip]['stdout']
except Exception, error:
print error
pass
There are no issues that match your filters.