Showing 30 of 30 total issues
Avoid deeply nested control flow statements. Open
for line in lines[:-1]:
os.write(write_fd, self.encode(transformer.transform(line) + '\n'))
if lines[-1]:
- Create a ticketCreate a ticket
Function run
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def run(self):
clean.run(self)
if self.all:
for path in [path.strip() for path in self.paths.split(',')]:
if os.path.isdir(path):
- Read upRead up
- Create a ticketCreate a ticket
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 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def __init__(self, name, help, short_option=None, long_option=None, before=None, after=None):
- Create a ticketCreate a ticket
Function __init__
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def __init__(self,
paths=None,
stdout_builder=None,
stderr_builder=None,
error_handler=lambda error: None):
- Read upRead up
- Create a ticketCreate a ticket
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 deeply nested control flow statements. Open
if enable_stderr_filtering:
self.stderr_builder.add_mapping(pattern, resolved_filter)
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
for read_fd in buffers:
buffers[read_fd] = ''
else:
- Create a ticketCreate a ticket
Avoid deeply nested control flow statements. Open
if lines[0] and buffers[read_fd]:
os.write(write_fd, self.encode('\r'))
for line in lines[:-1]:
- Create a ticketCreate a ticket
Function find_config_name_from_command_line
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def find_config_name_from_command_line(command_line_args):
for arg in command_line_args:
if arg[0] != '-':
basename = os.path.basename(arg)
if basename not in PRECOMMANDS:
- Read upRead up
- Create a ticketCreate a ticket
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 parse_args
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def parse_args(self, args=None, values=None):
try:
(values, remaining_args) = OptionParser.parse_args(self, args=args)
except SystemExit:
- Read upRead up
- Create a ticketCreate a ticket
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 makeparentdirs
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def makeparentdirs(path):
directory = os.path.dirname(path)
if not os.path.exists(directory): # no cover
try:
os.makedirs(directory)
- Read upRead up
- Create a ticketCreate a ticket
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"