NatLibFi/marc-record-validators-melinda

View on GitHub

Showing 830 of 830 total issues

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

async function callback({getFixture, enabled = true, fix = false}) {
  if (enabled === false) {
    debug('TEST SKIPPED!');
    return;
  }
Severity: Major
Found in src/resolveOrphanedSubfield6s.spec.js and 25 other locations - About 6 hrs to fix
src/field-008-18-34-character-groups.spec.js on lines 33..52
src/field-505-separators.spec.js on lines 33..52
src/field-521-fix.spec.js on lines 33..52
src/fix-country-codes.spec.js on lines 33..52
src/fixRelatorTerms.spec.js on lines 33..52
src/indicator-fixes.spec.js on lines 33..52
src/mergeField500Lisapainokset.spec.js on lines 33..52
src/mergeRelatorTermFields.spec.js on lines 33..52
src/multiple-subfield-0.spec.js on lines 33..52
src/normalize-dashes.spec.js on lines 33..52
src/normalize-identifiers.spec.js on lines 33..52
src/normalize-qualifying-information.spec.js on lines 33..52
src/normalize-utf8-diacritics.spec.js on lines 33..52
src/punctuation.spec.js on lines 33..52
src/punctuation2.spec.js on lines 33..52
src/reindexSubfield6OccurenceNumbers.spec.js on lines 33..52
src/removeDuplicateDataFields.spec.js on lines 33..52
src/removeInferiorDataFields.spec.js on lines 33..52
src/sanitize-vocabulary-source-codes.spec.js on lines 33..52
src/sortFields.spec.js on lines 33..52
src/sortRelatorTerms.spec.js on lines 33..52
src/stripPunctuation.spec.js on lines 33..52
src/subfieldValueNormalizations.spec.js on lines 33..52
src/sync-007-and-300.spec.js on lines 33..52
src/update-field-540.spec.js on lines 33..52

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

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

async function callback({getFixture, enabled = true, fix = false}) {
  if (enabled === false) {
    debug('TEST SKIPPED!');
    return;
  }
Severity: Major
Found in src/removeInferiorDataFields.spec.js and 25 other locations - About 6 hrs to fix
src/field-008-18-34-character-groups.spec.js on lines 33..52
src/field-505-separators.spec.js on lines 33..52
src/field-521-fix.spec.js on lines 33..52
src/fix-country-codes.spec.js on lines 33..52
src/fixRelatorTerms.spec.js on lines 33..52
src/indicator-fixes.spec.js on lines 33..52
src/mergeField500Lisapainokset.spec.js on lines 33..52
src/mergeRelatorTermFields.spec.js on lines 33..52
src/multiple-subfield-0.spec.js on lines 33..52
src/normalize-dashes.spec.js on lines 33..52
src/normalize-identifiers.spec.js on lines 33..52
src/normalize-qualifying-information.spec.js on lines 33..52
src/normalize-utf8-diacritics.spec.js on lines 33..52
src/punctuation.spec.js on lines 33..52
src/punctuation2.spec.js on lines 33..52
src/reindexSubfield6OccurenceNumbers.spec.js on lines 33..52
src/removeDuplicateDataFields.spec.js on lines 33..52
src/resolveOrphanedSubfield6s.spec.js on lines 33..52
src/sanitize-vocabulary-source-codes.spec.js on lines 33..52
src/sortFields.spec.js on lines 33..52
src/sortRelatorTerms.spec.js on lines 33..52
src/stripPunctuation.spec.js on lines 33..52
src/subfieldValueNormalizations.spec.js on lines 33..52
src/sync-007-and-300.spec.js on lines 33..52
src/update-field-540.spec.js on lines 33..52

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

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

async function callback({getFixture, enabled = true, fix = false}) {
  if (enabled === false) {
    debug('TEST SKIPPED!');
    return;
  }
Severity: Major
Found in src/subfieldValueNormalizations.spec.js and 25 other locations - About 6 hrs to fix
src/field-008-18-34-character-groups.spec.js on lines 33..52
src/field-505-separators.spec.js on lines 33..52
src/field-521-fix.spec.js on lines 33..52
src/fix-country-codes.spec.js on lines 33..52
src/fixRelatorTerms.spec.js on lines 33..52
src/indicator-fixes.spec.js on lines 33..52
src/mergeField500Lisapainokset.spec.js on lines 33..52
src/mergeRelatorTermFields.spec.js on lines 33..52
src/multiple-subfield-0.spec.js on lines 33..52
src/normalize-dashes.spec.js on lines 33..52
src/normalize-identifiers.spec.js on lines 33..52
src/normalize-qualifying-information.spec.js on lines 33..52
src/normalize-utf8-diacritics.spec.js on lines 33..52
src/punctuation.spec.js on lines 33..52
src/punctuation2.spec.js on lines 33..52
src/reindexSubfield6OccurenceNumbers.spec.js on lines 33..52
src/removeDuplicateDataFields.spec.js on lines 33..52
src/removeInferiorDataFields.spec.js on lines 33..52
src/resolveOrphanedSubfield6s.spec.js on lines 33..52
src/sanitize-vocabulary-source-codes.spec.js on lines 33..52
src/sortFields.spec.js on lines 33..52
src/sortRelatorTerms.spec.js on lines 33..52
src/stripPunctuation.spec.js on lines 33..52
src/sync-007-and-300.spec.js on lines 33..52
src/update-field-540.spec.js on lines 33..52

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

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

async function callback({getFixture, enabled = true, fix = false}) {
  if (enabled === false) {
    debug('TEST SKIPPED!');
    return;
  }
Severity: Major
Found in src/normalize-dashes.spec.js and 25 other locations - About 6 hrs to fix
src/field-008-18-34-character-groups.spec.js on lines 33..52
src/field-505-separators.spec.js on lines 33..52
src/field-521-fix.spec.js on lines 33..52
src/fix-country-codes.spec.js on lines 33..52
src/fixRelatorTerms.spec.js on lines 33..52
src/indicator-fixes.spec.js on lines 33..52
src/mergeField500Lisapainokset.spec.js on lines 33..52
src/mergeRelatorTermFields.spec.js on lines 33..52
src/multiple-subfield-0.spec.js on lines 33..52
src/normalize-identifiers.spec.js on lines 33..52
src/normalize-qualifying-information.spec.js on lines 33..52
src/normalize-utf8-diacritics.spec.js on lines 33..52
src/punctuation.spec.js on lines 33..52
src/punctuation2.spec.js on lines 33..52
src/reindexSubfield6OccurenceNumbers.spec.js on lines 33..52
src/removeDuplicateDataFields.spec.js on lines 33..52
src/removeInferiorDataFields.spec.js on lines 33..52
src/resolveOrphanedSubfield6s.spec.js on lines 33..52
src/sanitize-vocabulary-source-codes.spec.js on lines 33..52
src/sortFields.spec.js on lines 33..52
src/sortRelatorTerms.spec.js on lines 33..52
src/stripPunctuation.spec.js on lines 33..52
src/subfieldValueNormalizations.spec.js on lines 33..52
src/sync-007-and-300.spec.js on lines 33..52
src/update-field-540.spec.js on lines 33..52

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

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

    it('Moves invalid ISSN to y-subfield', async () => {
      const validator = await validatorFactory({handleInvalid: true});
      const record = new MarcRecord({
        fields: [
          {
Severity: Major
Found in src/isbn-issn.spec.js and 1 other location - About 6 hrs to fix
src/isbn-issn.spec.js on lines 251..269

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

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

    it('Moves invalid ISSN to y-subfield (Origin l-subfield)', async () => {
      const validator = await validatorFactory({handleInvalid: true});
      const record = new MarcRecord({
        fields: [
          {
Severity: Major
Found in src/isbn-issn.spec.js and 1 other location - About 6 hrs to fix
src/isbn-issn.spec.js on lines 231..249

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

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

File bib.js has 420 lines of code (exceeds 250 allowed). Consider refactoring.
Open

const bibRules =
[
  {
    selector: '[1678]00',
    namePortion: '$a',
Severity: Minor
Found in src/punctuation/rules/bib.js - About 6 hrs to fix

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

        const recordInvalidDouble = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '245',
    Severity: Major
    Found in src/field-exclusion.spec.js and 2 other locations - About 5 hrs to fix
    src/field-exclusion.spec.js on lines 246..272
    src/field-exclusion.spec.js on lines 464..490

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

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

        const recordInvalidDouble = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '245',
    Severity: Major
    Found in src/field-exclusion.spec.js and 2 other locations - About 5 hrs to fix
    src/field-exclusion.spec.js on lines 357..383
    src/field-exclusion.spec.js on lines 464..490

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

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

        const recordInvalidDouble = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '245',
    Severity: Major
    Found in src/field-exclusion.spec.js and 2 other locations - About 5 hrs to fix
    src/field-exclusion.spec.js on lines 246..272
    src/field-exclusion.spec.js on lines 357..383

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

    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

    Function default has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring.
    Open

    export default function (isLegalDeposit = false, useMelindaTemp = true) {
      const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda:urn');
      const debugData = debug.extend('data');
    
      // We should check that the f856 with URN has second indicator '0' (Resource), ' ' (No information provided) or '8' (No display constant generated)
    Severity: Minor
    Found in src/urn.js - About 5 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Function validateField has 138 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function validateField(field, linkedTag, fix, message) {
      // This is used to find last subfield that should have punctuation
      function findLastSubfield(field) {
        const subfields = field.subfields.filter(sf => isNaN(sf.code) && 'value' in sf);
        return subfields.slice(-1).shift();
    Severity: Major
    Found in src/ending-punctuation.js - About 5 hrs to fix

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

      async function testValidatorFactory() {
        const validator = await validatorFactory();
      
        expect(validator)
          .to.be.an('object')
      Severity: Major
      Found in src/addMissingField041.spec.js and 6 other locations - About 5 hrs to fix
      src/addMissingField336.spec.js on lines 20..30
      src/addMissingField337.spec.js on lines 20..30
      src/addMissingField338.spec.js on lines 20..30
      src/cyrillux-usemarcon-replacement.spec.js on lines 21..31
      src/cyrillux.spec.js on lines 20..30
      src/fix-33X.spec.js on lines 20..30

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

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

      async function testValidatorFactory() {
        const validator = await validatorFactory();
      
        expect(validator)
          .to.be.an('object')
      Severity: Major
      Found in src/addMissingField338.spec.js and 6 other locations - About 5 hrs to fix
      src/addMissingField041.spec.js on lines 20..30
      src/addMissingField336.spec.js on lines 20..30
      src/addMissingField337.spec.js on lines 20..30
      src/cyrillux-usemarcon-replacement.spec.js on lines 21..31
      src/cyrillux.spec.js on lines 20..30
      src/fix-33X.spec.js on lines 20..30

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

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

      async function testValidatorFactory() {
        const validator = await validatorFactory();
      
        expect(validator)
          .to.be.an('object')
      Severity: Major
      Found in src/fix-33X.spec.js and 6 other locations - About 5 hrs to fix
      src/addMissingField041.spec.js on lines 20..30
      src/addMissingField336.spec.js on lines 20..30
      src/addMissingField337.spec.js on lines 20..30
      src/addMissingField338.spec.js on lines 20..30
      src/cyrillux-usemarcon-replacement.spec.js on lines 21..31
      src/cyrillux.spec.js on lines 20..30

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

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

      async function testValidatorFactory() {
        const validator = await validatorFactory();
      
        expect(validator)
          .to.be.an('object')
      Severity: Major
      Found in src/cyrillux-usemarcon-replacement.spec.js and 6 other locations - About 5 hrs to fix
      src/addMissingField041.spec.js on lines 20..30
      src/addMissingField336.spec.js on lines 20..30
      src/addMissingField337.spec.js on lines 20..30
      src/addMissingField338.spec.js on lines 20..30
      src/cyrillux.spec.js on lines 20..30
      src/fix-33X.spec.js on lines 20..30

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

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

      async function testValidatorFactory() {
        const validator = await validatorFactory();
      
        expect(validator)
          .to.be.an('object')
      Severity: Major
      Found in src/addMissingField336.spec.js and 6 other locations - About 5 hrs to fix
      src/addMissingField041.spec.js on lines 20..30
      src/addMissingField337.spec.js on lines 20..30
      src/addMissingField338.spec.js on lines 20..30
      src/cyrillux-usemarcon-replacement.spec.js on lines 21..31
      src/cyrillux.spec.js on lines 20..30
      src/fix-33X.spec.js on lines 20..30

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

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

      async function testValidatorFactory() {
        const validator = await validatorFactory();
      
        expect(validator)
          .to.be.an('object')
      Severity: Major
      Found in src/addMissingField337.spec.js and 6 other locations - About 5 hrs to fix
      src/addMissingField041.spec.js on lines 20..30
      src/addMissingField336.spec.js on lines 20..30
      src/addMissingField338.spec.js on lines 20..30
      src/cyrillux-usemarcon-replacement.spec.js on lines 21..31
      src/cyrillux.spec.js on lines 20..30
      src/fix-33X.spec.js on lines 20..30

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

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

      async function testValidatorFactory() {
        const validator = await validatorFactory();
      
        expect(validator)
          .to.be.an('object')
      Severity: Major
      Found in src/cyrillux.spec.js and 6 other locations - About 5 hrs to fix
      src/addMissingField041.spec.js on lines 20..30
      src/addMissingField336.spec.js on lines 20..30
      src/addMissingField337.spec.js on lines 20..30
      src/addMissingField338.spec.js on lines 20..30
      src/cyrillux-usemarcon-replacement.spec.js on lines 21..31
      src/fix-33X.spec.js on lines 20..30

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

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

      async function callback({getFixture, fix = false}) {
        const validator = await validatorFactory();
        const record = new MarcRecord(getFixture('record.json'));
        const expectedResult = getFixture('expectedResult.json');
        // console.log(expectedResult); // eslint-disable-line
      Severity: Major
      Found in src/cyrillux-usemarcon-replacement.spec.js and 6 other locations - About 5 hrs to fix
      src/addMissingField041.spec.js on lines 32..46
      src/addMissingField336.spec.js on lines 32..46
      src/addMissingField338.spec.js on lines 32..46
      src/fix-33X.spec.js on lines 32..46
      src/fix-language-codes.spec.js on lines 31..45
      src/typeOfDate-008.spec.js on lines 33..47

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

      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

      Severity
      Category
      Status
      Source
      Language