Showing 35 of 90 total issues
Avoid deeply nested control flow statements. Open
if not skip:
print(clean_text.split("\n")[:2])
markup, result = engine.get_improved_markup(clean_text)
raw_writer.write_markup(markup)
else:
Avoid deeply nested control flow statements. Open
for word in line.words:
syllable_count += len(word.syllables)
if len(stress_lines[line_number]) != syllable_count:
Avoid deeply nested control flow statements. Open
if name == "":
continue
print(name, author)
Avoid deeply nested control flow statements. Open
for theme in element['themes']:
data[id]['themes'].add(theme)
elif data[id]['text'] is None:
Avoid deeply nested control flow statements. Open
if len(element['text']) > len(data[id]['text']):
data[id]['text'] = element['text']
self.duplicates_count += 1
Avoid deeply nested control flow statements. Open
for line in lines:
if line == "":
continue
for ch in line:
if "a" < ch < "z" or "A" < ch < "Z" or ch == "Ј":
Avoid deeply nested control flow statements. Open
if syllable.text[i] in VOWELS:
syllable.stress = syllable.begin + i
Avoid deeply nested control flow statements. Open
for j in range(3):
flag1 = get_actual_line(element['text'], i) in get_actual_line(data[id]['text'], j)
flag2 = get_actual_line(data[id]['text'], i) in get_actual_line(element['text'], j)
is_duplicate = is_duplicate or flag1 or flag2
if not is_duplicate:
Function create_user
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def create_user(self, email, organisation, password=None, first_name=None, last_name=None):
Function handle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
output = options.get('out')
with open(output, "w", encoding='utf-8') as f:
content = '['
poems = [poem for poem in Poem.objects.all() if poem.count_manual_markups() != 0]
- 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 to_sketch
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def to_sketch(self, filename, fields):
with open(filename, 'w', encoding='utf-8') as f:
content = '<?xml version="1.0" encoding="UTF-8"?><items>'
for element in self.data:
xml = '<doc '
- 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 get_context_data
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def get_context_data(self, **kwargs):
context = super(PoemView, self).get_context_data(**kwargs)
poem = self.get_object()
max_pk = Poem.objects.latest('pk').pk
- 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 getCookie
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getCookie(name) {
var cookieValue = null;
if (document.cookie && document.cookie != '') {
var cookies = document.cookie.split(';');
for (var i = 0; i < cookies.length; i++) {
- 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 handle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def handle(self, *args, **options):
poems = Poem.objects.all()
directory = os.path.join(BASE_DIR, "datasets", "corpus", "all_raw")
if os.path.exists(directory):
for path in os.listdir(directory):
- 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 get_accents
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def get_accents(markup: Markup):
accents = []
for line in markup.lines:
for word in line.words:
for syllable in word.syllables:
- 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"