NodeBB/NodeBB

View on GitHub
public/src/admin/dashboard.js

Summary

Maintainability
D
2 days
Test Coverage

Function setupGraphs has 239 lines of code (exceeds 75 allowed). Consider refactoring.
Open

function setupGraphs(callback) {
    callback = callback || function () {};
    const trafficCanvas = document.getElementById('analytics-traffic');
    const registeredCanvas = document.getElementById('analytics-registered');
    const presenceCanvas = document.getElementById('analytics-presence');
Severity: Major
Found in public/src/admin/dashboard.js - About 7 hrs to fix

    File dashboard.js has 513 lines of code (exceeds 500 allowed). Consider refactoring.
    Open

    import {
        Chart,
        LineController,
        DoughnutController,
        CategoryScale,
    Severity: Major
    Found in public/src/admin/dashboard.js - About 2 hrs to fix

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

                      {
                          label: translations[1],
                          fill: 'origin',
                          tension: tension,
                          backgroundColor: '#ab464233',
      Severity: Major
      Found in public/src/admin/dashboard.js and 4 other locations - About 1 hr to fix
      public/src/admin/dashboard.js on lines 182..193
      public/src/admin/dashboard.js on lines 206..217
      public/src/admin/dashboard.js on lines 218..229
      public/src/admin/dashboard.js on lines 230..241

      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 81.

      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 5 locations. Consider refactoring.
      Open

                      {
                          label: translations[2],
                          fill: 'origin',
                          tension: tension,
                          backgroundColor: '#ba8baf33',
      Severity: Major
      Found in public/src/admin/dashboard.js and 4 other locations - About 1 hr to fix
      public/src/admin/dashboard.js on lines 182..193
      public/src/admin/dashboard.js on lines 194..205
      public/src/admin/dashboard.js on lines 218..229
      public/src/admin/dashboard.js on lines 230..241

      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 81.

      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 5 locations. Consider refactoring.
      Open

                      {
                          label: translations[4],
                          fill: 'origin',
                          tension: tension,
                          backgroundColor: 'rgba(151,187,205,0.2)',
      Severity: Major
      Found in public/src/admin/dashboard.js and 4 other locations - About 1 hr to fix
      public/src/admin/dashboard.js on lines 182..193
      public/src/admin/dashboard.js on lines 194..205
      public/src/admin/dashboard.js on lines 206..217
      public/src/admin/dashboard.js on lines 218..229

      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 81.

      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 5 locations. Consider refactoring.
      Open

                      {
                          label: translations[3],
                          fill: 'origin',
                          tension: tension,
                          backgroundColor: '#f7ca8833',
      Severity: Major
      Found in public/src/admin/dashboard.js and 4 other locations - About 1 hr to fix
      public/src/admin/dashboard.js on lines 182..193
      public/src/admin/dashboard.js on lines 194..205
      public/src/admin/dashboard.js on lines 206..217
      public/src/admin/dashboard.js on lines 230..241

      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 81.

      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 5 locations. Consider refactoring.
      Open

                      {
                          label: translations[0],
                          fill: 'origin',
                          tension: tension,
                          backgroundColor: 'rgba(220,220,220,0.2)',
      Severity: Major
      Found in public/src/admin/dashboard.js and 4 other locations - About 1 hr to fix
      public/src/admin/dashboard.js on lines 194..205
      public/src/admin/dashboard.js on lines 206..217
      public/src/admin/dashboard.js on lines 218..229
      public/src/admin/dashboard.js on lines 230..241

      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 81.

      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

      There are no issues that match your filters.

      Category
      Status