Showing 7 of 15 total issues
Function open_proto_file
has a Cognitive Complexity of 106 (exceeds 5 allowed). Consider refactoring. Open
Open
def open_proto_file(main_file, head_for_files):
new_proto_single_file = main_file.replace(raw_name, input_file)
if os.path.exists(new_proto_single_file):
os.unlink(new_proto_single_file)
open_for_new = open(new_proto_single_file, 'a')
- 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
File compile_base.py
has 298 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import argparse
import operator
Avoid deeply nested control flow statements. Open
Open
if os.path.exists(gen_last_files + "/" + v2):
if v2 not in includes:
includes.append(v2)
elif message.startswith('\trepeated') or message.startswith('\t\trepeated') or message.startswith(
Avoid deeply nested control flow statements. Open
Open
if os.path.exists(gen_last_files + "/" + file_for_includes) and file_for_includes not in includes:
includes.append(file_for_includes)
else:
Avoid deeply nested control flow statements. Open
Open
if os.path.exists(gen_last_files + "/" + v1):
if v1 not in includes:
includes.append(v1)
if os.path.exists(gen_last_files + "/" + v2):
Avoid deeply nested control flow statements. Open
Open
if os.path.exists(gen_last_files + "/" + file_for_includes) and file_for_includes not in includes:
includes.append(file_for_includes)
if len(includes) > 0:
Avoid deeply nested control flow statements. Open
Open
if file == 'ITEM.proto':
continue
files_inc += 'import "' + file + '";\n'