subprocess call with shell=True identified, security issue. Open
ping_process = subprocess.Popen(
cmd,
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
- Exclude checks
Consider possible security implications associated with subprocess module. Open
import subprocess
- Exclude checks
Function call with shell=True parameter identified, possible security issue. Open
interface_type = process.system_output(
cmd, shell=True, ignore_status=True
- Exclude checks
Function call with shell=True parameter identified, possible security issue. Open
interface_type = process.system_output(
cmd, shell=True, ignore_status=True
- Exclude checks
File interfaces.py
has 707 lines of code (exceeds 250 allowed). Consider refactoring. Open
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
Function save
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
def save(self, ipaddr, netmask):
"""Save current interface IP Address to the system configuration file.
If the ipaddr is valid (currently being used by the interface)
this will try to save the current settings into /etc/. This
- 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 validate_ipv4_netmask_format
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def validate_ipv4_netmask_format(self, netmask):
"""
This function validates IPv4 Netmask address with following format set.
1. A string in decimal-dot notation,consisting of four decimal integers
- 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 config_filename
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def config_filename(self):
current_distro = distro_detect()
if current_distro.name in ["rhel", "fedora"]:
if self.distro_is_rhel9:
path = "/etc/NetworkManager/system-connections"
- 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 restore_slave_cfg_file
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def restore_slave_cfg_file(self):
"""
Restore or delete slave config files.
"""
if self.if_type != "Bond":
- 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. Open
return True
Function config_file_path
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def config_file_path(self):
current_distro = distro_detect()
if current_distro.name in ["rhel", "fedora"]:
if self.distro_is_rhel9:
return "/etc/NetworkManager/system-connections"
- 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"