datacite/bracco

View on GitHub
app/controllers/repositories/show/dois/new.js

Summary

Maintainability
F
5 days
Test Coverage

Function submit has 173 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    submit(doi) {
      doi.set('event', this.setEvent(doi.get('state')));

      // schema-version will be determined by API
      doi.set('schemaVersion', 'http://datacite.org/schema/kernel-4');
Severity: Major
Found in app/controllers/repositories/show/dois/new.js - About 6 hrs to fix

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

          doi.set(
            'contributors',
            A(doi.get('contributors')).filter(function (contributor) {
              let nameIdentifiers = A(contributor.get('nameIdentifiers')).filter(
                function (nameIdentifier) {
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 1 other location - About 1 day to fix
    app/controllers/dois/show/edit.js on lines 88..113

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

    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

          doi.set(
            'geoLocations',
            A(doi.get('geoLocations')).filter(function (geoLocation) {
              let point =
                isBlank(geoLocation.geoLocationPoint.pointLongitude) &&
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 1 other location - About 1 day to fix
    app/controllers/dois/show/edit.js on lines 149..171

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

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

          A(doi.get('creators')).forEach((creator) => {
            creator.set(
              'nameIdentifiers',
              A(creator.get('nameIdentifiers')).filter(function (nameIdentifier) {
                return !isBlank(nameIdentifier.nameIdentifier);
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 1 other location - About 6 hrs to fix
    app/controllers/dois/show/edit.js on lines 52..69

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

    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

          doi.set(
            'relatedItems',
            A(doi.get('relatedItems')).filter(function (item) {
              let titles = A(item.get('titles')).filter(function (title) {
                return !isBlank(title.title);
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 1 other location - About 4 hrs to fix
    app/controllers/dois/show/edit.js on lines 222..235

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

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

          doi.set(
            'relatedIdentifiers',
            A(doi.get('relatedIdentifiers')).filter(function (identifier) {
              return (
                !isBlank(identifier.relatedIdentifier) ||
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 3 other locations - About 3 hrs to fix
    app/controllers/dois/show/edit.js on lines 128..139
    app/controllers/dois/show/edit.js on lines 208..219
    app/controllers/repositories/show/dois/new.js on lines 192..203

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

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

          doi.set(
            'fundingReferences',
            A(doi.get('fundingReferences')).filter(function (fundingReference) {
              return (
                !isBlank(fundingReference.funderName) ||
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 3 other locations - About 3 hrs to fix
    app/controllers/dois/show/edit.js on lines 128..139
    app/controllers/dois/show/edit.js on lines 208..219
    app/controllers/repositories/show/dois/new.js on lines 112..123

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

    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

          doi.set(
            'dates',
            A(doi.get('dates')).filter(function (date) {
              return (
                !isBlank(date.date) ||
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 1 other location - About 2 hrs to fix
    app/controllers/dois/show/edit.js on lines 116..125

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

    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 8 locations. Consider refactoring.
    Wontfix

          doi.set(
            'alternateIdentifiers',
            A(doi.get('alternateIdentifiers')).filter(function (
              alternateIdentifier
            ) {
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 7 other locations - About 1 hr to fix
    app/controllers/dois/show/edit.js on lines 72..77
    app/controllers/dois/show/edit.js on lines 80..85
    app/controllers/dois/show/edit.js on lines 174..181
    app/controllers/dois/show/edit.js on lines 184..189
    app/controllers/repositories/show/dois/new.js on lines 56..61
    app/controllers/repositories/show/dois/new.js on lines 64..69
    app/controllers/repositories/show/dois/new.js on lines 168..173

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

    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 8 locations. Consider refactoring.
    Wontfix

          doi.set(
            'rightsList',
            A(doi.get('rightsList')).filter(function (rights) {
              return !isBlank(rights.rights);
            })
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 7 other locations - About 1 hr to fix
    app/controllers/dois/show/edit.js on lines 72..77
    app/controllers/dois/show/edit.js on lines 80..85
    app/controllers/dois/show/edit.js on lines 174..181
    app/controllers/dois/show/edit.js on lines 184..189
    app/controllers/repositories/show/dois/new.js on lines 56..61
    app/controllers/repositories/show/dois/new.js on lines 64..69
    app/controllers/repositories/show/dois/new.js on lines 158..165

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

    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 8 locations. Consider refactoring.
    Wontfix

          doi.set(
            'titles',
            A(doi.get('titles')).filter(function (title) {
              return !isBlank(title.title);
            })
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 7 other locations - About 1 hr to fix
    app/controllers/dois/show/edit.js on lines 72..77
    app/controllers/dois/show/edit.js on lines 80..85
    app/controllers/dois/show/edit.js on lines 174..181
    app/controllers/dois/show/edit.js on lines 184..189
    app/controllers/repositories/show/dois/new.js on lines 64..69
    app/controllers/repositories/show/dois/new.js on lines 158..165
    app/controllers/repositories/show/dois/new.js on lines 168..173

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

    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 8 locations. Consider refactoring.
    Wontfix

          doi.set(
            'subjects',
            A(doi.get('subjects')).filter(function (subject) {
              return !isBlank(subject.subject);
            })
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 7 other locations - About 1 hr to fix
    app/controllers/dois/show/edit.js on lines 72..77
    app/controllers/dois/show/edit.js on lines 80..85
    app/controllers/dois/show/edit.js on lines 174..181
    app/controllers/dois/show/edit.js on lines 184..189
    app/controllers/repositories/show/dois/new.js on lines 56..61
    app/controllers/repositories/show/dois/new.js on lines 158..165
    app/controllers/repositories/show/dois/new.js on lines 168..173

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

    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

          doi.set(
            'descriptions',
            A(doi.get('descriptions')).filter(function (description) {
              return !isBlank(description.description);
            })
    Severity: Minor
    Found in app/controllers/repositories/show/dois/new.js and 1 other location - About 55 mins to fix
    app/controllers/dois/show/edit.js on lines 142..147

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

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

          doi.set(
            'formats',
            A(doi.get('formats')).filter(function (format) {
              return !isBlank(format);
            })
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 3 other locations - About 50 mins to fix
    app/controllers/dois/show/edit.js on lines 192..197
    app/controllers/dois/show/edit.js on lines 200..205
    app/controllers/repositories/show/dois/new.js on lines 176..181

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

          doi.set(
            'sizes',
            A(doi.get('sizes')).filter(function (size) {
              return !isBlank(size);
            })
    Severity: Major
    Found in app/controllers/repositories/show/dois/new.js and 3 other locations - About 50 mins to fix
    app/controllers/dois/show/edit.js on lines 192..197
    app/controllers/dois/show/edit.js on lines 200..205
    app/controllers/repositories/show/dois/new.js on lines 184..189

    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

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

      setEvent(state) {
        if (state === 'registered') {
          return 'register';
        } else if (state === 'findable') {
          return 'publish';
    Severity: Minor
    Found in app/controllers/repositories/show/dois/new.js and 1 other location - About 30 mins to fix
    app/controllers/repositories/show/dois/upload.js on lines 8..16

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

    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