portainer/portainer

View on GitHub
app/kubernetes/custom-templates/index.js

Summary

Maintainability
A
3 hrs
Test Coverage

Function config has 45 lines of code (exceeds 25 allowed). Consider refactoring.
Open

function config($stateRegistryProvider) {
  const templates = {
    name: 'kubernetes.templates',
    url: '/templates',
    abstract: true,
Severity: Minor
Found in app/kubernetes/custom-templates/index.js - About 1 hr to fix

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

      const customTemplatesNew = {
        name: 'kubernetes.templates.custom.new',
        url: '/new?fileContent',
    
        views: {
    Severity: Minor
    Found in app/kubernetes/custom-templates/index.js and 1 other location - About 50 mins to fix
    app/portainer/user-activity/index.js on lines 46..60

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

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

      const customTemplates = {
        name: 'kubernetes.templates.custom',
        url: '/custom',
    
        views: {
    Severity: Major
    Found in app/kubernetes/custom-templates/index.js and 38 other locations - About 35 mins to fix
    app/docker/__module.js on lines 112..124
    app/docker/__module.js on lines 162..173
    app/docker/__module.js on lines 511..522
    app/docker/__module.js on lines 574..585
    app/docker/__module.js on lines 587..598
    app/docker/__module.js on lines 600..611
    app/docker/__module.js on lines 613..624
    app/edge/__module.js on lines 21..32
    app/edge/__module.js on lines 54..65
    app/edge/__module.js on lines 67..78
    app/edge/__module.js on lines 95..106
    app/kubernetes/__module.js on lines 134..145
    app/kubernetes/__module.js on lines 147..158
    app/kubernetes/__module.js on lines 160..171
    app/kubernetes/__module.js on lines 173..184
    app/kubernetes/__module.js on lines 196..207
    app/kubernetes/__module.js on lines 209..220
    app/kubernetes/__module.js on lines 222..233
    app/kubernetes/__module.js on lines 235..246
    app/kubernetes/__module.js on lines 324..335
    app/kubernetes/__module.js on lines 356..367
    app/kubernetes/__module.js on lines 379..390
    app/kubernetes/__module.js on lines 392..403
    app/kubernetes/__module.js on lines 415..426
    app/kubernetes/__module.js on lines 428..439
    app/kubernetes/__module.js on lines 441..452
    app/kubernetes/__module.js on lines 454..465
    app/kubernetes/__module.js on lines 467..478
    app/kubernetes/__module.js on lines 480..491
    app/kubernetes/__module.js on lines 493..504
    app/kubernetes/__module.js on lines 516..527
    app/kubernetes/__module.js on lines 539..550
    app/portainer/__module.js on lines 177..188
    app/portainer/__module.js on lines 215..226
    app/portainer/__module.js on lines 318..329
    app/portainer/__module.js on lines 368..379
    app/portainer/__module.js on lines 381..392
    app/portainer/__module.js on lines 422..433

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

    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