datacite/bracco

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

Summary

Maintainability
D
1 day
Test Coverage

Function updateRelatedItemIdentifier has 76 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  updateRelatedItemIdentifier(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-item-identifier.js - About 3 hrs to fix

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

          case arxiv.test(value):
            this.fragment.set('relatedItemIdentifier', value);
            this.fragment.set('relatedItemIdentifierType', 'arXiv');
            this.set('controlledIdentifierType', true);
            break;
    Severity: Major
    Found in app/components/doi-related-item-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-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 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.
    Open

          case ark.test(value):
            this.fragment.set('relatedItemIdentifier', value);
            this.fragment.set('relatedItemIdentifierType', 'ARK');
            this.set('controlledIdentifierType', true);
            break;
    Severity: Major
    Found in app/components/doi-related-item-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-identifier.js on lines 203..207
    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.
    Open

          case doiUrl.test(value):
            this.fragment.set('relatedItemIdentifier', value);
            this.fragment.set('relatedItemIdentifierType', 'DOI');
            this.set('controlledIdentifierType', true);
            break;
    Severity: Major
    Found in app/components/doi-related-item-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-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 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.
    Open

          case bibcode.test(value):
            this.fragment.set('relatedItemIdentifier', value);
            this.fragment.set('relatedItemIdentifierType', 'bibcode');
            this.set('controlledIdentifierType', true);
            break;
    Severity: Major
    Found in app/components/doi-related-item-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-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 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.
    Open

          case doi.test(value):
            this.fragment.set('relatedItemIdentifier', value);
            this.fragment.set('relatedItemIdentifierType', 'DOI');
            this.set('controlledIdentifierType', true);
            break;
    Severity: Major
    Found in app/components/doi-related-item-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-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 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.
    Open

          case urn.test(value):
            this.fragment.set('relatedItemIdentifier', value);
            this.fragment.set('relatedIdentifierType', 'URN');
            this.set('controlledIdentifierType', true);
            break;
    Severity: Major
    Found in app/components/doi-related-item-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-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

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

          case lsid.test(value):
            this.fragment.set('relatedItemIdentifier', value);
            this.fragment.set('relatedItemIdentifierType', 'LSID');
            this.set('controlledIdentifierType', true);
            break;
    Severity: Major
    Found in app/components/doi-related-item-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-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 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.
    Open

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

    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

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

          case isISBN(value):
            this.fragment.set('relatedItemIdentifier', value);
            this.fragment.set('relatedIdentifierType', 'ISBN');
            this.set('controlledIdentifierType', true);
            break;
    Severity: Minor
    Found in app/components/doi-related-item-identifier.js and 1 other location - About 55 mins to fix
    app/components/doi-related-item-identifier.js on lines 116..120

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

          case isBlank(value):
            this.fragment.set('relatedItemIdentifier', null);
            this.fragment.set('relatedItemIdentifierType', null);
            this.set('controlledIdentifierType', false);
            break;
    Severity: Minor
    Found in app/components/doi-related-item-identifier.js and 1 other location - About 55 mins to fix
    app/components/doi-rights.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 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 2 locations. Consider refactoring.
    Open

          case isURL(value):
            this.fragment.set('relatedItemIdentifier', value);
            this.fragment.set('relatedItemIdentifierType', 'URL');
            this.set('controlledIdentifierType', true);
            break;
    Severity: Minor
    Found in app/components/doi-related-item-identifier.js and 1 other location - About 55 mins to fix
    app/components/doi-related-item-identifier.js on lines 111..115

    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

    There are no issues that match your filters.

    Category
    Status