datacite/bracco

View on GitHub
app/routes/providers/show/prefixes/index.js

Summary

Maintainability
B
5 hrs
Test Coverage

Function model has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  model(params) {
    let providerId = null;
    let consortiumId = null;
    let model = this.modelFor('providers/show');
    if (model.memberType === 'consortium') {
Severity: Minor
Found in app/routes/providers/show/prefixes/index.js - About 1 hr to fix

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

          prefixes: this.store
            .query('provider-prefix', params, { reload: true })
            .then(function (result) {
              return result;
            })
    Severity: Major
    Found in app/routes/providers/show/prefixes/index.js and 1 other location - About 1 hr to fix
    app/routes/repositories/show/prefixes/index.js on lines 25..33

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

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

      afterModel() {
        if (this.can.cannot('read provider', this.modelFor('providers/show'))) {
          this.router.transitionTo('index');
        }
      }
    Severity: Major
    Found in app/routes/providers/show/prefixes/index.js and 12 other locations - About 50 mins to fix
    app/routes/contacts/show/edit.js on lines 14..18
    app/routes/providers/show/contacts/index.js on lines 62..66
    app/routes/providers/show/dois.js on lines 52..56
    app/routes/providers/show/organizations/index.js on lines 65..69
    app/routes/providers/show/repositories/index.js on lines 61..65
    app/routes/repositories/show/analytics.js on lines 27..33
    app/routes/repositories/show/dois/index.js on lines 44..50
    app/routes/repositories/show/edit.js on lines 15..21
    app/routes/repositories/show/info.js on lines 27..33
    app/routes/repositories/show/prefixes/index.js on lines 37..43
    app/routes/repositories/show/transfer.js on lines 26..32
    app/routes/users/show/info.js on lines 29..33

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

      queryParams: {
        page: {
          refreshModel: true
        },
        size: {
    Severity: Minor
    Found in app/routes/providers/show/prefixes/index.js and 1 other location - About 45 mins to fix
    app/routes/providers/show/repositories/index.js on lines 46..59

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

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

        if (model.memberType === 'consortium') {
          consortiumId = model.get('id');
        } else {
          providerId = model.get('id');
        }
    Severity: Major
    Found in app/routes/providers/show/prefixes/index.js and 2 other locations - About 40 mins to fix
    app/routes/providers/show/dois.js on lines 15..19
    app/routes/providers/show/repositories/index.js on lines 17..21

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

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

        params = assign(params, {
          page: {
            number: params.page,
            size: params.size
          },
    Severity: Major
    Found in app/routes/providers/show/prefixes/index.js and 3 other locations - About 35 mins to fix
    app/routes/providers/show/contacts/index.js on lines 21..28
    app/routes/providers/show/dois.js on lines 20..27
    app/routes/providers/show/repositories/index.js on lines 22..29

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

    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