itarverne/checklist-seo

View on GitHub

Showing 40 of 40 total issues

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        checkLength() {
            fetch("/seo/length/", {
                method: "POST",
                credentials: 'include',
                body: JSON.stringify(this.getText()),
Severity: Major
Found in seo/static/js/seoSidePannel.js and 1 other location - About 1 day to fix
seo/static/js/seoSidePannel.js on lines 316..344

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 294.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

        checkInternalLinks() {
            fetch("/seo/internal_links/", {
                method: "POST",
                credentials: 'include',
                body: JSON.stringify(this.getHtml()),
Severity: Major
Found in seo/static/js/seoSidePannel.js and 1 other location - About 1 day to fix
seo/static/js/seoSidePannel.js on lines 232..260

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 294.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

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")
Severity: Minor
Found in seo/static/js/seoSidePannel.js - About 6 hrs to fix

    TestApi has 45 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class TestApi:
    
        # frequency tests
    
        def test_frequency_not_ajax(self):
    Severity: Minor
    Found in seo/testing/test_api.py - About 6 hrs to fix

      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 constructor has 80 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              constructor(props) {
                  super(props);
                  this.state = {
                      keywordScore: 0,
                      lengthScore: 0,
      Severity: Major
      Found in seo/static/js/seoSidePannel.js - About 3 hrs to fix

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                    document.getElementById("id_keyword").addEventListener('keyup', () => {
                        clearTimeout(this.state.seoKeyWordInputTimeout);
                        this.setState({
                            seoKeyWordInputTimeout: setTimeout(() => {
                                this.checkKeyword();
        Severity: Major
        Found in seo/static/js/seoSidePannel.js and 2 other locations - About 3 hrs to fix
        seo/static/js/seoSidePannel.js on lines 72..80
        seo/static/js/seoSidePannel.js on lines 81..89

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 95.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                    document.getElementById("id_slug").addEventListener("input", () => {
                        clearTimeout(this.state.seoSlugInputTimeout);
                        this.setState({
                            seoSlugInputTimeout: setTimeout(() => {
                                this.checkSlug();
        Severity: Major
        Found in seo/static/js/seoSidePannel.js and 2 other locations - About 3 hrs to fix
        seo/static/js/seoSidePannel.js on lines 40..48
        seo/static/js/seoSidePannel.js on lines 72..80

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 95.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                    document.getElementById("id_title").addEventListener("input", () => {
                        clearTimeout(this.state.seoTitleInputTimeout);
                        this.setState({
                            seoTitleInputTimeout: setTimeout(() => {
                                this.checkTitle();
        Severity: Major
        Found in seo/static/js/seoSidePannel.js and 2 other locations - About 3 hrs to fix
        seo/static/js/seoSidePannel.js on lines 40..48
        seo/static/js/seoSidePannel.js on lines 81..89

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 95.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                    fetch("/seo/title_in_article/", {
                        method: "POST",
                        credentials: 'include',
                        body: JSON.stringify(text),
                        headers: {
        Severity: Major
        Found in seo/static/js/seoSidePannel.js and 2 other locations - About 2 hrs to fix
        seo/static/js/seoSidePannel.js on lines 265..289
        seo/static/js/seoSidePannel.js on lines 295..314

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 94.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                    fetch("/seo/title/", {
                        method: "POST",
                        credentials: 'include',
                        body: JSON.stringify(body),
                        headers: {
        Severity: Major
        Found in seo/static/js/seoSidePannel.js and 2 other locations - About 2 hrs to fix
        seo/static/js/seoSidePannel.js on lines 295..314
        seo/static/js/seoSidePannel.js on lines 355..374

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 94.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 3 locations. Consider refactoring.
        Open

                    fetch("/seo/slug/", {
                        method: "POST",
                        credentials: 'include',
                        body: JSON.stringify(body),
                        headers: {
        Severity: Major
        Found in seo/static/js/seoSidePannel.js and 2 other locations - About 2 hrs to fix
        seo/static/js/seoSidePannel.js on lines 265..289
        seo/static/js/seoSidePannel.js on lines 355..374

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 94.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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" },
        Severity: Major
        Found in seo/static/js/seoSidePannel.js - About 2 hrs to fix

          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

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                              if (block.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
                                  .parentNode.parentNode.parentNode.parentNode.children[0].children[2].children[0].innerHTML != "Code") {
                                  for (let line of block.firstChild.children) {
                                      if (!line.classList.contains('Draftail-block--atomic')) {
                                          if (line.classList.contains('public-DraftStyleDefault-ol')
          Severity: Major
          Found in seo/static/js/seoSidePannel.js and 1 other location - About 1 hr to fix
          seo/static/js/seoSidePannel.js on lines 147..150

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 74.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

                              if (block.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode.parentNode
                                  .parentNode.parentNode.parentNode.children[0].children[2].children[0].innerHTML != "Code") {
                                  text += block.firstChild.firstChild.firstChild.innerHTML;
                              }
          Severity: Major
          Found in seo/static/js/seoSidePannel.js and 1 other location - About 1 hr to fix
          seo/static/js/seoSidePannel.js on lines 110..133

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 74.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          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 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 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/", {
          Severity: Minor
          Found in seo/static/js/seoSidePannel.js - About 1 hr to fix

            Similar blocks of code found in 2 locations. Consider refactoring.
            Open

                                e('div', null,
                                    [
                                        e('i', { class: `icon ${this.state.internalLinksValidationColor}` },
                                            null),
                                        e('span', { title: "There must be internal links, the best is 5" },
            Severity: Major
            Found in seo/static/js/seoSidePannel.js and 1 other location - About 1 hr to fix
            seo/static/js/seoSidePannel.js on lines 396..404

            Duplicated Code

            Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

            Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

            When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

            Tuning

            This issue has a mass of 68.

            We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

            The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

            If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

            See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

            Refactorings

            Further Reading

            Severity
            Category
            Status
            Source
            Language