Showing 24 of 40 total issues
File seoSidePannel.js
has 432 lines of code (exceeds 250 allowed). Consider refactoring. Open
document.addEventListener('DOMContentLoaded', function () {
var e = React.createElement;
sidePannel = document.createElement('div');
sidePannel.classList.add("seo_side_pannel")
TestApi
has 45 functions (exceeds 20 allowed). Consider refactoring. Open
class TestApi:
# frequency tests
def test_frequency_not_ajax(self):
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 constructor
has 80 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(props) {
super(props);
this.state = {
keywordScore: 0,
lengthScore: 0,
Function render
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return [
e('div', { class: "seo-title" },
[
e('img', { class: 'seo-logo', src: '/static/images/seo_logo.png', alt: "logo seo" },
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 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 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 checkKeyword
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkKeyword() {
let body = [];
body[0] = document.getElementById("id_keyword").value;
body[1] = this.getText();
fetch("/seo/keyword/", {
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 getText
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
getText() {
let blocks = document.getElementsByClassName("notranslate public-DraftEditor-content");
let text = "";
for (let block of blocks) {
// we make sure we don’t get deleted blocks’s content
Function check_h1_in_content
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
check_h1_in_content() {
var rich_text_blocks = document.getElementsByClassName("DraftEditor-root");
var text;
for (let block of rich_text_blocks) {
text += block.innerHTML;
Function checkTitle
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkTitle() {
var body = [];
body[0] = document.getElementById("id_keyword").value;
body[1] = document.getElementById("id_title").value;
fetch("/seo/title/", {
Function checkInternalLinks
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkInternalLinks() {
fetch("/seo/internal_links/", {
method: "POST",
credentials: 'include',
body: JSON.stringify(this.getHtml()),
Function checkLength
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
checkLength() {
fetch("/seo/length/", {
method: "POST",
credentials: 'include',
body: JSON.stringify(this.getText()),
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 deeply nested control flow statements. Open
if (!line.classList.contains('Draftail-block--atomic')) {
if (line.classList.contains('public-DraftStyleDefault-ol')
|| line.classList.contains('public-DraftStyleDefault-ul')) {
for (let child of line.children) {
text += " " + child.firstChild.firstChild.firstChild.innerHTML;
Function getCookie
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function getCookie(name) {
let cookieValue = null;
if (document.cookie && document.cookie !== '') {
const cookies = document.cookie.split(';');
for (let 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
Avoid too many return
statements within this function. Open
return ERROR_JSON