Function check_keyword
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def check_keyword(request):
"""Checks if the Keyword is valid"""
if request.is_ajax():
if request.method == 'POST':
data = json.loads(request.body.decode('utf-8'))
- 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 check_title
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def check_title(request):
"""Check if the title is valid"""
if request.is_ajax():
if request.method == 'POST':
data = json.loads(request.body.decode('utf-8'))
- 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 article_length
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def article_length(request):
"""Returns a code telling if the article is of appropriate length regarding seo rules."""
if request.is_ajax():
if request.method == 'POST':
text = json.loads(request.body.decode('utf-8'))
- 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 check_slug
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def check_slug(request):
"""Check if the slug is valid"""
if request.is_ajax():
if request.method == 'POST':
data = json.loads(request.body.decode('utf-8'))
- 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 frequency
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def frequency(request):
"""Returns the frequency of the given word."""
if request.is_ajax():
if request.method == 'POST':
text = json.loads(request.body.decode('utf-8'))
- 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 check_internal_links
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def check_internal_links(request):
"""Returns a code telling if the article has enough internal links."""
if request.is_ajax():
if request.method == 'POST':
text = json.loads(request.body.decode('utf-8'))
- 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 check_title_in_article
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def check_title_in_article(request):
"""Check there are no h1 in the content of the article"""
if request.is_ajax():
if request.method == 'POST':
text = json.loads(request.body.decode('utf-8'))
- 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 ERROR_JSON
Avoid too many return
statements within this function. Open
return JsonResponse({"response": "VALID_SLUG"})
Avoid too many return
statements within this function. Open
return ERROR_JSON
Avoid too many return
statements within this function. Open
return ERROR_JSON
Avoid too many return
statements within this function. Open
return JsonResponse({"response": "VALID_TITLE", "keyword_present": is_keyword_present, "character_count": title_character_count, "word_count": title_word_count})