NatLibFi/marc-record-validators-melinda

View on GitHub

Showing 1,137 of 1,137 total issues

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

    {
      'tag': '884',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
Severity: Major
Found in src/melindaCustomMergeFields.js and 8 other locations - About 3 hrs to fix
src/melindaCustomMergeFields.js on lines 196..208
src/melindaCustomMergeFields.js on lines 325..337
src/melindaCustomMergeFields.js on lines 1112..1124
src/melindaCustomMergeFields.js on lines 2037..2049
src/melindaCustomMergeFields.js on lines 2816..2828
src/melindaCustomMergeFields.js on lines 4622..4634
src/melindaCustomMergeFields.js on lines 5014..5026
src/melindaCustomMergeFields.js on lines 5117..5127

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

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

    {'tag': 'CAT',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [
Severity: Major
Found in src/melindaCustomMergeFields.js and 8 other locations - About 3 hrs to fix
src/melindaCustomMergeFields.js on lines 196..208
src/melindaCustomMergeFields.js on lines 325..337
src/melindaCustomMergeFields.js on lines 1112..1124
src/melindaCustomMergeFields.js on lines 2037..2049
src/melindaCustomMergeFields.js on lines 2816..2828
src/melindaCustomMergeFields.js on lines 4622..4634
src/melindaCustomMergeFields.js on lines 4653..4665
src/melindaCustomMergeFields.js on lines 5014..5026

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

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

    {
      'tag': '882',
      'repeatable': false,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
Severity: Major
Found in src/melindaCustomMergeFields.js and 8 other locations - About 3 hrs to fix
src/melindaCustomMergeFields.js on lines 196..208
src/melindaCustomMergeFields.js on lines 325..337
src/melindaCustomMergeFields.js on lines 1112..1124
src/melindaCustomMergeFields.js on lines 2037..2049
src/melindaCustomMergeFields.js on lines 2816..2828
src/melindaCustomMergeFields.js on lines 4653..4665
src/melindaCustomMergeFields.js on lines 5014..5026
src/melindaCustomMergeFields.js on lines 5117..5127

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

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

    {
      'tag': '585',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
Severity: Major
Found in src/melindaCustomMergeFields.js and 8 other locations - About 3 hrs to fix
src/melindaCustomMergeFields.js on lines 196..208
src/melindaCustomMergeFields.js on lines 325..337
src/melindaCustomMergeFields.js on lines 1112..1124
src/melindaCustomMergeFields.js on lines 2037..2049
src/melindaCustomMergeFields.js on lines 4622..4634
src/melindaCustomMergeFields.js on lines 4653..4665
src/melindaCustomMergeFields.js on lines 5014..5026
src/melindaCustomMergeFields.js on lines 5117..5127

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

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

    {
      'tag': '250',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
Severity: Major
Found in src/melindaCustomMergeFields.js and 8 other locations - About 3 hrs to fix
src/melindaCustomMergeFields.js on lines 196..208
src/melindaCustomMergeFields.js on lines 325..337
src/melindaCustomMergeFields.js on lines 2037..2049
src/melindaCustomMergeFields.js on lines 2816..2828
src/melindaCustomMergeFields.js on lines 4622..4634
src/melindaCustomMergeFields.js on lines 4653..4665
src/melindaCustomMergeFields.js on lines 5014..5026
src/melindaCustomMergeFields.js on lines 5117..5127

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

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

    it('Finds the record invalid - double', async () => {
      const validator = await validatorFactory(config);
      const {valid, message} = await validator.validate(recordInvalidDouble);
      expect({valid, message}).to.eql({valid: false, message: ['Field $500 should be excluded', 'Field $500 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 2 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 409..413
src/field-exclusion.spec.js on lines 516..520

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

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

      const recordInvalidComplex = new MarcRecord({
        leader: '',
        fields: [
          {
            tag: '880',
Severity: Major
Found in src/ending-punctuation.spec.js and 1 other location - About 3 hrs to fix
src/ending-punctuation.spec.js on lines 2451..2466

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

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

      const recordValidComplex = new MarcRecord({
        leader: '',
        fields: [
          {
            tag: '880',
Severity: Major
Found in src/ending-punctuation.spec.js and 1 other location - About 3 hrs to fix
src/ending-punctuation.spec.js on lines 2497..2512

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

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

    it('Finds the record invalid - double', async () => {
      const validator = await validatorFactory(config);
      const {valid, message} = await validator.validate(recordInvalidDouble);
      expect({valid, message}).to.eql({valid: false, message: ['Field $648 should be excluded', 'Field $650 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 2 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 298..302
src/field-exclusion.spec.js on lines 516..520

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

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

    it('Finds the record invalid - double', async () => {
      const validator = await validatorFactory(config);
      const {valid, message} = await validator.validate(recordInvalidDouble);
      expect({valid, message}).to.eql({valid: false, message: ['Field $648 should be excluded', 'Field $650 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 2 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 298..302
src/field-exclusion.spec.js on lines 409..413

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

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

    it('Finds the record invalid (spec)', async () => {
      const validator = await validatorFactory(config);
      const {valid, message} = await validator.validate(recordInvalid);
      expect({valid, message}).to.eql({valid: false, message: ['Field $500 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 6 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 292..296
src/field-exclusion.spec.js on lines 403..407
src/field-exclusion.spec.js on lines 510..514
src/field-exclusion.spec.js on lines 720..724
src/field-exclusion.spec.js on lines 842..846
src/field-exclusion.spec.js on lines 848..852

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

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

    it('Finds the record invalid (spec)', async () => {
      const validator = await validatorFactory(config);
      const {valid, message} = await validator.validate(recordInvalid);
      expect({valid, message}).to.eql({valid: false, message: ['Field $650 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 6 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 292..296
src/field-exclusion.spec.js on lines 403..407
src/field-exclusion.spec.js on lines 510..514
src/field-exclusion.spec.js on lines 603..607
src/field-exclusion.spec.js on lines 842..846
src/field-exclusion.spec.js on lines 848..852

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

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

    it('Finds the record invalid (spec)', async () => {
      const validator = await validatorFactory(config);
      const {valid, message} = await validator.validate(recordInvalid);
      expect({valid, message}).to.eql({valid: false, message: ['Field $500 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 6 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 403..407
src/field-exclusion.spec.js on lines 510..514
src/field-exclusion.spec.js on lines 603..607
src/field-exclusion.spec.js on lines 720..724
src/field-exclusion.spec.js on lines 842..846
src/field-exclusion.spec.js on lines 848..852

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

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

    it('Finds the record invalid - Ind', async () => {
      const validator = await validatorFactory(configInd);
      const {valid, message} = await validator.validate(recordIndInvalid);
      expect({valid, message}).to.eql({valid: false, message: ['Field $500 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 6 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 292..296
src/field-exclusion.spec.js on lines 403..407
src/field-exclusion.spec.js on lines 510..514
src/field-exclusion.spec.js on lines 603..607
src/field-exclusion.spec.js on lines 720..724
src/field-exclusion.spec.js on lines 848..852

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

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

    it('Finds the record invalid (spec)', async () => {
      const validator = await validatorFactory(config);
      const {valid, message} = await validator.validate(recordInvalid);
      expect({valid, message}).to.eql({valid: false, message: ['Field $648 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 6 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 292..296
src/field-exclusion.spec.js on lines 510..514
src/field-exclusion.spec.js on lines 603..607
src/field-exclusion.spec.js on lines 720..724
src/field-exclusion.spec.js on lines 842..846
src/field-exclusion.spec.js on lines 848..852

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

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

    it('Finds the record invalid - Value', async () => {
      const validator = await validatorFactory(configValue);
      const {valid, message} = await validator.validate(recordValueInvalid);
      expect({valid, message}).to.eql({valid: false, message: ['Field $500 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 6 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 292..296
src/field-exclusion.spec.js on lines 403..407
src/field-exclusion.spec.js on lines 510..514
src/field-exclusion.spec.js on lines 603..607
src/field-exclusion.spec.js on lines 720..724
src/field-exclusion.spec.js on lines 842..846

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

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

    it('Finds the record invalid (spec)', async () => {
      const validator = await validatorFactory(config);
      const {valid, message} = await validator.validate(recordInvalid);
      expect({valid, message}).to.eql({valid: false, message: ['Field $648 should be excluded']});
    });
Severity: Major
Found in src/field-exclusion.spec.js and 6 other locations - About 3 hrs to fix
src/field-exclusion.spec.js on lines 292..296
src/field-exclusion.spec.js on lines 403..407
src/field-exclusion.spec.js on lines 603..607
src/field-exclusion.spec.js on lines 720..724
src/field-exclusion.spec.js on lines 842..846
src/field-exclusion.spec.js on lines 848..852

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

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 22 (exceeds 5 allowed). Consider refactoring.
Open

export default function (configuration) {
  if (Array.isArray(configuration)) {
    return {
      description:
        'Validates fixed fields',
Severity: Minor
Found in src/fixed-fields.js - About 3 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

File removeDuplicateDataFields.js has 295 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import createDebugLogger from 'debug';
import {fieldsToString, fieldToString, nvdebug} from './utils';
import {fieldHasValidSubfield6, fieldsGetOccurrenceNumbers, fieldsToNormalizedString, fieldToNormalizedString, get6s} from './subfield6Utils';
import {add8s, fieldHasLinkingNumber, fieldHasValidSubfield8, fieldsGetAllSubfield8LinkingNumbers, getSubfield8LinkingNumber, recordGetAllSubfield8LinkingNumbers, recordGetFieldsWithSubfield8LinkingNumber} from './subfield8Utils';

Severity: Minor
Found in src/removeDuplicateDataFields.js - About 3 hrs to fix

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

        it('Finds the record valid - Ind1&Ind2', async () => {
          const validator = await validatorFactory(configInd);
          const {valid, message} = await validator.validate(recordValid);
          expect({valid, message}).to.eql({valid: true, message: []});
        });
    Severity: Major
    Found in src/field-exclusion.spec.js and 6 other locations - About 3 hrs to fix
    src/field-exclusion.spec.js on lines 286..290
    src/field-exclusion.spec.js on lines 397..401
    src/field-exclusion.spec.js on lines 504..508
    src/field-exclusion.spec.js on lines 597..601
    src/field-exclusion.spec.js on lines 714..718
    src/field-exclusion.spec.js on lines 836..840

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

    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