datacite/bracco

View on GitHub
app/components/doi-related-identifier.js

Summary

Maintainability
B
6 hrs
Test Coverage

Function updateRelatedIdentifier has 81 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

  updateRelatedIdentifier(value) {
    const ark = /^ark:\/[0-9]{5}\/\S+$/;
    const lsid =
      /^[uU][rR][nN]:[lL][sS][iI][dD]:(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%]):(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%]):(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%])[:]?(A-Za-z0-9][A-Za-z0-9()+,-.=@;$_!*'"%])?$/;
    const purl = {
Severity: Major
Found in app/components/doi-related-identifier.js - About 3 hrs to fix

    File doi-related-identifier.js has 264 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* eslint-disable no-useless-escape */
    import Component from '@ember/component';
    import { inject as service } from '@ember/service';
    import { isURL, isISBN } from 'validator';
    import { isBlank } from '@ember/utils';
    Severity: Minor
    Found in app/components/doi-related-identifier.js - About 2 hrs to fix

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

          if (this.isMetadataRelationTypes.includes(selectedRelationType)) {
            this.set('isMetadataRelationType', true);
          } else {
            this.set('isMetadataRelationType', false);
            this.fragment.set('schemeType', null);
      Severity: Major
      Found in app/components/doi-related-identifier.js and 1 other location - About 3 hrs to fix
      app/components/doi-related-item.js on lines 120..127

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

            case arxiv.test(value):
              this.fragment.set('relatedIdentifier', value);
              this.fragment.set('relatedIdentifierType', 'arXiv');
              this.set('controlledIdentifierType', true);
              break;
      Severity: Major
      Found in app/components/doi-related-identifier.js and 13 other locations - About 1 hr to fix
      app/components/doi-related-identifier.js on lines 168..172
      app/components/doi-related-identifier.js on lines 178..182
      app/components/doi-related-identifier.js on lines 183..187
      app/components/doi-related-identifier.js on lines 188..192
      app/components/doi-related-identifier.js on lines 193..197
      app/components/doi-related-identifier.js on lines 203..207
      app/components/doi-related-item-identifier.js on lines 71..75
      app/components/doi-related-item-identifier.js on lines 76..80
      app/components/doi-related-item-identifier.js on lines 81..85
      app/components/doi-related-item-identifier.js on lines 86..90
      app/components/doi-related-item-identifier.js on lines 91..95
      app/components/doi-related-item-identifier.js on lines 96..100
      app/components/doi-related-item-identifier.js on lines 106..110

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

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

            case doi.test(value):
              this.fragment.set('relatedIdentifier', value);
              this.fragment.set('relatedIdentifierType', 'DOI');
              this.set('controlledIdentifierType', true);
              break;
      Severity: Major
      Found in app/components/doi-related-identifier.js and 13 other locations - About 1 hr to fix
      app/components/doi-related-identifier.js on lines 168..172
      app/components/doi-related-identifier.js on lines 173..177
      app/components/doi-related-identifier.js on lines 183..187
      app/components/doi-related-identifier.js on lines 188..192
      app/components/doi-related-identifier.js on lines 193..197
      app/components/doi-related-identifier.js on lines 203..207
      app/components/doi-related-item-identifier.js on lines 71..75
      app/components/doi-related-item-identifier.js on lines 76..80
      app/components/doi-related-item-identifier.js on lines 81..85
      app/components/doi-related-item-identifier.js on lines 86..90
      app/components/doi-related-item-identifier.js on lines 91..95
      app/components/doi-related-item-identifier.js on lines 96..100
      app/components/doi-related-item-identifier.js on lines 106..110

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

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

            case lsid.test(value):
              this.fragment.set('relatedIdentifier', value);
              this.fragment.set('relatedIdentifierType', 'LSID');
              this.set('controlledIdentifierType', true);
              break;
      Severity: Major
      Found in app/components/doi-related-identifier.js and 13 other locations - About 1 hr to fix
      app/components/doi-related-identifier.js on lines 168..172
      app/components/doi-related-identifier.js on lines 173..177
      app/components/doi-related-identifier.js on lines 178..182
      app/components/doi-related-identifier.js on lines 183..187
      app/components/doi-related-identifier.js on lines 188..192
      app/components/doi-related-identifier.js on lines 203..207
      app/components/doi-related-item-identifier.js on lines 71..75
      app/components/doi-related-item-identifier.js on lines 76..80
      app/components/doi-related-item-identifier.js on lines 81..85
      app/components/doi-related-item-identifier.js on lines 86..90
      app/components/doi-related-item-identifier.js on lines 91..95
      app/components/doi-related-item-identifier.js on lines 96..100
      app/components/doi-related-item-identifier.js on lines 106..110

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

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

            case bibcode.test(value):
              this.fragment.set('relatedIdentifier', value);
              this.fragment.set('relatedIdentifierType', 'bibcode');
              this.set('controlledIdentifierType', true);
              break;
      Severity: Major
      Found in app/components/doi-related-identifier.js and 13 other locations - About 1 hr to fix
      app/components/doi-related-identifier.js on lines 168..172
      app/components/doi-related-identifier.js on lines 173..177
      app/components/doi-related-identifier.js on lines 178..182
      app/components/doi-related-identifier.js on lines 183..187
      app/components/doi-related-identifier.js on lines 193..197
      app/components/doi-related-identifier.js on lines 203..207
      app/components/doi-related-item-identifier.js on lines 71..75
      app/components/doi-related-item-identifier.js on lines 76..80
      app/components/doi-related-item-identifier.js on lines 81..85
      app/components/doi-related-item-identifier.js on lines 86..90
      app/components/doi-related-item-identifier.js on lines 91..95
      app/components/doi-related-item-identifier.js on lines 96..100
      app/components/doi-related-item-identifier.js on lines 106..110

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

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

            case ark.test(value):
              this.fragment.set('relatedIdentifier', value);
              this.fragment.set('relatedIdentifierType', 'ARK');
              this.set('controlledIdentifierType', true);
              break;
      Severity: Major
      Found in app/components/doi-related-identifier.js and 13 other locations - About 1 hr to fix
      app/components/doi-related-identifier.js on lines 173..177
      app/components/doi-related-identifier.js on lines 178..182
      app/components/doi-related-identifier.js on lines 183..187
      app/components/doi-related-identifier.js on lines 188..192
      app/components/doi-related-identifier.js on lines 193..197
      app/components/doi-related-identifier.js on lines 203..207
      app/components/doi-related-item-identifier.js on lines 71..75
      app/components/doi-related-item-identifier.js on lines 76..80
      app/components/doi-related-item-identifier.js on lines 81..85
      app/components/doi-related-item-identifier.js on lines 86..90
      app/components/doi-related-item-identifier.js on lines 91..95
      app/components/doi-related-item-identifier.js on lines 96..100
      app/components/doi-related-item-identifier.js on lines 106..110

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

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

            case urn.test(value):
              this.fragment.set('relatedIdentifier', value);
              this.fragment.set('relatedIdentifierType', 'URN');
              this.set('controlledIdentifierType', true);
              break;
      Severity: Major
      Found in app/components/doi-related-identifier.js and 13 other locations - About 1 hr to fix
      app/components/doi-related-identifier.js on lines 168..172
      app/components/doi-related-identifier.js on lines 173..177
      app/components/doi-related-identifier.js on lines 178..182
      app/components/doi-related-identifier.js on lines 183..187
      app/components/doi-related-identifier.js on lines 188..192
      app/components/doi-related-identifier.js on lines 193..197
      app/components/doi-related-item-identifier.js on lines 71..75
      app/components/doi-related-item-identifier.js on lines 76..80
      app/components/doi-related-item-identifier.js on lines 81..85
      app/components/doi-related-item-identifier.js on lines 86..90
      app/components/doi-related-item-identifier.js on lines 91..95
      app/components/doi-related-item-identifier.js on lines 96..100
      app/components/doi-related-item-identifier.js on lines 106..110

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

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

            case doiUrl.test(value):
              this.fragment.set('relatedIdentifier', value);
              this.fragment.set('relatedIdentifierType', 'DOI');
              this.set('controlledIdentifierType', true);
              break;
      Severity: Major
      Found in app/components/doi-related-identifier.js and 13 other locations - About 1 hr to fix
      app/components/doi-related-identifier.js on lines 168..172
      app/components/doi-related-identifier.js on lines 173..177
      app/components/doi-related-identifier.js on lines 178..182
      app/components/doi-related-identifier.js on lines 188..192
      app/components/doi-related-identifier.js on lines 193..197
      app/components/doi-related-identifier.js on lines 203..207
      app/components/doi-related-item-identifier.js on lines 71..75
      app/components/doi-related-item-identifier.js on lines 76..80
      app/components/doi-related-item-identifier.js on lines 81..85
      app/components/doi-related-item-identifier.js on lines 86..90
      app/components/doi-related-item-identifier.js on lines 91..95
      app/components/doi-related-item-identifier.js on lines 96..100
      app/components/doi-related-item-identifier.js on lines 106..110

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

      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

          if (
            relatedIdentifierTypeList.includes(
              this.fragment.get('relatedIdentifierType')
            )
          ) {
      Severity: Major
      Found in app/components/doi-related-identifier.js and 1 other location - About 1 hr to fix
      app/components/doi-funding-reference.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 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 2 locations. Consider refactoring.
      Open

            case isURL(value, purl):
              this.fragment.set('relatedIdentifier', value);
              this.fragment.set('relatedIdentifierType', 'PURL');
              this.set('controlledIdentifierType', true);
              break;
      Severity: Minor
      Found in app/components/doi-related-identifier.js and 1 other location - About 55 mins to fix
      app/components/doi-related-item-identifier.js on lines 101..105

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

      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

        init(...args) {
          this._super(...args);
      
          this.isMetadataRelationTypes = this.isMetadataRelationTypes || [
            'HasMetadata',
      Severity: Minor
      Found in app/components/doi-related-identifier.js and 1 other location - About 35 mins to fix
      app/components/doi-related-item.js on lines 87..94

      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