itarverne/checklist-seo

View on GitHub
seo/views.py

Summary

Maintainability
D
2 days
Test Coverage

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'))
Severity: Minor
Found in seo/views.py - About 3 hrs to fix

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'))
Severity: Minor
Found in seo/views.py - About 2 hrs to fix

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'))
Severity: Minor
Found in seo/views.py - About 1 hr to fix

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'))
Severity: Minor
Found in seo/views.py - About 1 hr to fix

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'))
Severity: Minor
Found in seo/views.py - About 1 hr to fix

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'))
Severity: Minor
Found in seo/views.py - About 1 hr to fix

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'))
Severity: Minor
Found in seo/views.py - About 55 mins to fix

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
Severity: Major
Found in seo/views.py - About 30 mins to fix

    Avoid too many return statements within this function.
    Open

                return JsonResponse({"response": "VALID_SLUG"})
    Severity: Major
    Found in seo/views.py - About 30 mins to fix

      Avoid too many return statements within this function.
      Open

          return ERROR_JSON
      Severity: Major
      Found in seo/views.py - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

            return ERROR_JSON
        Severity: Major
        Found in seo/views.py - About 30 mins to fix

          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})
          Severity: Major
          Found in seo/views.py - About 30 mins to fix

            There are no issues that match your filters.

            Category
            Status