NatLibFi/marc-record-validators-melinda

View on GitHub

Showing 830 of 830 total issues

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 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 $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 - 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 $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 (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

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

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

          if (punctType === 'PERIOD' && !(/\.$/u).test(preceedingSubfield.value)) { // eslint-disable-line functional/no-conditional-statements
            const nextValue = `${preceedingSubfield.value}.`;
            debug(`Updated subfield ${preceedingSubfield.code} from '${preceedingSubfield.value}' to '${nextValue}'`);
            preceedingSubfield.value = nextValue; // eslint-disable-line functional/immutable-data
          }
    Severity: Major
    Found in src/punctuation/index.js and 2 other locations - About 3 hrs to fix
    src/punctuation/index.js on lines 259..263
    src/punctuation/index.js on lines 265..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 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

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

        it('Finds the record valid - Value', async () => {
          const validator = await validatorFactory(configValue);
          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 830..834

    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

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

        it('Finds the record valid (spec)', async () => {
          const validator = await validatorFactory(config);
          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 597..601
    src/field-exclusion.spec.js on lines 714..718
    src/field-exclusion.spec.js on lines 830..834
    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

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

        it('Finds the record valid (spec)', async () => {
          const validator = await validatorFactory(config);
          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 714..718
    src/field-exclusion.spec.js on lines 830..834
    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

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

        it('Finds the record valid (spec)', async () => {
          const validator = await validatorFactory(config);
          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 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 830..834
    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

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

        it('Finds the record valid (spec)', async () => {
          const validator = await validatorFactory(config);
          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 830..834
    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

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

            if (type === 'SEMICOLON' && !(/;$/u).test(preceedingSubfield.value)) { // eslint-disable-line functional/no-conditional-statements
              const nextValue = `${preceedingSubfield.value} ;`;
              debug(`Updated subfield ${preceedingSubfield.code} from '${preceedingSubfield.value}' to '${nextValue}'`);
              preceedingSubfield.value = nextValue; // eslint-disable-line functional/immutable-data
            }
    Severity: Major
    Found in src/punctuation/index.js and 2 other locations - About 3 hrs to fix
    src/punctuation/index.js on lines 176..180
    src/punctuation/index.js on lines 265..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 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

    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

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

          const recordValidMultiple = new MarcRecord({
            leader: '',
            fields: [
              {
                tag: '242',
    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 355..370

    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

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

            if (type === 'COLON' && !(/:$/u).test(preceedingSubfield.value)) { // eslint-disable-line functional/no-conditional-statements
              const nextValue = `${preceedingSubfield.value} :`;
              debug(`Updated subfield ${preceedingSubfield.code} from '${preceedingSubfield.value}' to '${nextValue}'`);
              preceedingSubfield.value = nextValue; // eslint-disable-line functional/immutable-data
            }
    Severity: Major
    Found in src/punctuation/index.js and 2 other locations - About 3 hrs to fix
    src/punctuation/index.js on lines 176..180
    src/punctuation/index.js on lines 259..263

    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