NatLibFi/marc-record-validators-melinda

View on GitHub
src/subfield-exclusion.spec.js

Summary

Maintainability
F
1 wk
Test Coverage

File subfield-exclusion.spec.js has 453 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import {expect} from 'chai';
//import chaiAsPromised from 'chai-as-promised';
import {MarcRecord} from '@natlibfi/marc-record';
import validatorFactory from '../src/subfield-exclusion';

Severity: Minor
Found in src/subfield-exclusion.spec.js - About 6 hrs to fix

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

        const recordIndInvalid = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '245',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 9 other locations - About 3 hrs to fix
    src/field-exclusion.spec.js on lines 226..244
    src/field-exclusion.spec.js on lines 337..355
    src/field-exclusion.spec.js on lines 444..462
    src/field-exclusion.spec.js on lines 545..563
    src/field-exclusion.spec.js on lines 565..583
    src/field-exclusion.spec.js on lines 625..643
    src/field-exclusion.spec.js on lines 645..663
    src/field-exclusion.spec.js on lines 783..801
    src/field-structure.spec.js on lines 386..414

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

    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 recordInvalid = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '100',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 1 other location - About 3 hrs to fix
    src/subfield-exclusion.spec.js on lines 374..392

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

    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 recordInvalid = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '210',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 1 other location - About 3 hrs to fix
    src/subfield-exclusion.spec.js on lines 240..258

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

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

        const recordInvalidFixed = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '100',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 5 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 223..238
    src/subfield-exclusion.spec.js on lines 305..320
    src/subfield-exclusion.spec.js on lines 357..372
    src/subfield-exclusion.spec.js on lines 394..409
    src/subfield-exclusion.spec.js on lines 479..494

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

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

        const recordIndInvalidFixed = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '245',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 5 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 223..238
    src/subfield-exclusion.spec.js on lines 260..275
    src/subfield-exclusion.spec.js on lines 305..320
    src/subfield-exclusion.spec.js on lines 357..372
    src/subfield-exclusion.spec.js on lines 394..409

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

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

        const recordValid = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '210',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 5 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 223..238
    src/subfield-exclusion.spec.js on lines 260..275
    src/subfield-exclusion.spec.js on lines 305..320
    src/subfield-exclusion.spec.js on lines 394..409
    src/subfield-exclusion.spec.js on lines 479..494

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

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

        const recordOriginal = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '041',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 5 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 223..238
    src/subfield-exclusion.spec.js on lines 260..275
    src/subfield-exclusion.spec.js on lines 357..372
    src/subfield-exclusion.spec.js on lines 394..409
    src/subfield-exclusion.spec.js on lines 479..494

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

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

        const recordInvalidFixed = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '210',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 5 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 223..238
    src/subfield-exclusion.spec.js on lines 260..275
    src/subfield-exclusion.spec.js on lines 305..320
    src/subfield-exclusion.spec.js on lines 357..372
    src/subfield-exclusion.spec.js on lines 479..494

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

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

        const recordValid = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '100',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 5 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 260..275
    src/subfield-exclusion.spec.js on lines 305..320
    src/subfield-exclusion.spec.js on lines 357..372
    src/subfield-exclusion.spec.js on lines 394..409
    src/subfield-exclusion.spec.js on lines 479..494

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

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

        it('Finds the record invalid (spec)', async () => {
          const validator = await validatorFactory(config);
          const result = await validator.validate(recordInvalid);
          expect(result).to.eql({valid: false, message: ['Subfield $210$$2should be excluded']});
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 3 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 283..287
    src/subfield-exclusion.spec.js on lines 334..338
    src/subfield-exclusion.spec.js on lines 502..506

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

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

        it('Finds the record invalid (spec)', async () => {
          const validator = await validatorFactory(config);
          const result = await validator.validate(recordInvalid);
          expect(result).to.eql({valid: false, message: ['Subfield $100$$4should be excluded']});
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 3 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 334..338
    src/subfield-exclusion.spec.js on lines 417..421
    src/subfield-exclusion.spec.js on lines 502..506

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

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

        it('Finds the record with 041$a zxx invalid (spec)', async () => {
          const validator = await validatorFactory(config);
          const result = await validator.validate(recordOriginal);
          expect(result).to.eql({valid: false, message: ['Subfield $041$$ashould be excluded']});
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 3 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 283..287
    src/subfield-exclusion.spec.js on lines 417..421
    src/subfield-exclusion.spec.js on lines 502..506

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

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

        it('Finds the record invalid - Ind', async () => {
          const validator = await validatorFactory(configInd);
          const result = await validator.validate(recordIndInvalid);
          expect(result).to.eql({valid: false, message: ['Subfield $500$$2should be excluded']});
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 3 other locations - About 2 hrs to fix
    src/subfield-exclusion.spec.js on lines 283..287
    src/subfield-exclusion.spec.js on lines 334..338
    src/subfield-exclusion.spec.js on lines 417..421

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

    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 valid - Ind1&Ind2', async () => {
          const validator = await validatorFactory(configInd);
          const result = await validator.validate(recordValid);
          expect(result).to.eql({valid: true, message: []});
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 2 other locations - About 1 hr to fix
    src/subfield-exclusion.spec.js on lines 277..281
    src/subfield-exclusion.spec.js on lines 411..415

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

    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 valid (spec)', async () => {
          const validator = await validatorFactory(config);
          const result = await validator.validate(recordValid);
          expect(result).to.eql({valid: true, message: []});
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 2 other locations - About 1 hr to fix
    src/subfield-exclusion.spec.js on lines 277..281
    src/subfield-exclusion.spec.js on lines 496..500

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

    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 valid (spec)', async () => {
          const validator = await validatorFactory(config);
          const result = await validator.validate(recordValid);
          expect(result).to.eql({valid: true, message: []});
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 2 other locations - About 1 hr to fix
    src/subfield-exclusion.spec.js on lines 411..415
    src/subfield-exclusion.spec.js on lines 496..500

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

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

        it('Repairs invalid record', async () => {
          const validator = await validatorFactory(config);
          await validator.fix(recordInvalid);
          expect(recordInvalid.equalsTo(recordInvalidFixed)).to.eql(true);
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 14 other locations - About 1 hr to fix
    src/field-exclusion.spec.js on lines 304..308
    src/field-exclusion.spec.js on lines 310..314
    src/field-exclusion.spec.js on lines 415..419
    src/field-exclusion.spec.js on lines 421..425
    src/field-exclusion.spec.js on lines 522..526
    src/field-exclusion.spec.js on lines 528..532
    src/field-exclusion.spec.js on lines 609..613
    src/field-exclusion.spec.js on lines 738..742
    src/field-exclusion.spec.js on lines 744..748
    src/field-exclusion.spec.js on lines 854..858
    src/field-exclusion.spec.js on lines 860..864
    src/subfield-exclusion.spec.js on lines 289..293
    src/subfield-exclusion.spec.js on lines 340..344
    src/subfield-exclusion.spec.js on lines 508..512

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

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

        it('Repairs invalid record', async () => {
          const validator = await validatorFactory(config);
          await validator.fix(recordInvalid);
          expect(recordInvalid.equalsTo(recordInvalidFixed)).to.eql(true);
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 14 other locations - About 1 hr to fix
    src/field-exclusion.spec.js on lines 304..308
    src/field-exclusion.spec.js on lines 310..314
    src/field-exclusion.spec.js on lines 415..419
    src/field-exclusion.spec.js on lines 421..425
    src/field-exclusion.spec.js on lines 522..526
    src/field-exclusion.spec.js on lines 528..532
    src/field-exclusion.spec.js on lines 609..613
    src/field-exclusion.spec.js on lines 738..742
    src/field-exclusion.spec.js on lines 744..748
    src/field-exclusion.spec.js on lines 854..858
    src/field-exclusion.spec.js on lines 860..864
    src/subfield-exclusion.spec.js on lines 340..344
    src/subfield-exclusion.spec.js on lines 423..427
    src/subfield-exclusion.spec.js on lines 508..512

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

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

        it('Repairs invalid record', async () => {
          const validator = await validatorFactory(configInd);
          await validator.fix(recordIndInvalid);
          expect(recordIndInvalid.equalsTo(recordIndInvalidFixed)).to.eql(true);
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 14 other locations - About 1 hr to fix
    src/field-exclusion.spec.js on lines 304..308
    src/field-exclusion.spec.js on lines 310..314
    src/field-exclusion.spec.js on lines 415..419
    src/field-exclusion.spec.js on lines 421..425
    src/field-exclusion.spec.js on lines 522..526
    src/field-exclusion.spec.js on lines 528..532
    src/field-exclusion.spec.js on lines 609..613
    src/field-exclusion.spec.js on lines 738..742
    src/field-exclusion.spec.js on lines 744..748
    src/field-exclusion.spec.js on lines 854..858
    src/field-exclusion.spec.js on lines 860..864
    src/subfield-exclusion.spec.js on lines 289..293
    src/subfield-exclusion.spec.js on lines 340..344
    src/subfield-exclusion.spec.js on lines 423..427

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

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

        it('Repairs invalid record', async () => {
          const validator = await validatorFactory(config);
          await validator.fix(recordOriginal);
          expect(recordOriginal.equalsTo(recordModified)).to.eql(true);
        });
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 14 other locations - About 1 hr to fix
    src/field-exclusion.spec.js on lines 304..308
    src/field-exclusion.spec.js on lines 310..314
    src/field-exclusion.spec.js on lines 415..419
    src/field-exclusion.spec.js on lines 421..425
    src/field-exclusion.spec.js on lines 522..526
    src/field-exclusion.spec.js on lines 528..532
    src/field-exclusion.spec.js on lines 609..613
    src/field-exclusion.spec.js on lines 738..742
    src/field-exclusion.spec.js on lines 744..748
    src/field-exclusion.spec.js on lines 854..858
    src/field-exclusion.spec.js on lines 860..864
    src/subfield-exclusion.spec.js on lines 289..293
    src/subfield-exclusion.spec.js on lines 423..427
    src/subfield-exclusion.spec.js on lines 508..512

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

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

        const recordModified = new MarcRecord({
          leader: 'foo',
          fields: [
            {
              tag: '245',
    Severity: Major
    Found in src/subfield-exclusion.spec.js and 16 other locations - About 1 hr to fix
    src/ending-punctuation.spec.js on lines 149..159
    src/ending-punctuation.spec.js on lines 1270..1280
    src/ending-punctuation.spec.js on lines 1333..1343
    src/ending-punctuation.spec.js on lines 1908..1918
    src/ending-punctuation.spec.js on lines 2078..2088
    src/ending-punctuation.spec.js on lines 2335..2345
    src/ending-punctuation.spec.js on lines 2376..2386
    src/field-exclusion.spec.js on lines 214..224
    src/field-exclusion.spec.js on lines 274..284
    src/field-exclusion.spec.js on lines 325..335
    src/field-exclusion.spec.js on lines 385..395
    src/field-exclusion.spec.js on lines 492..502
    src/field-exclusion.spec.js on lines 585..595
    src/field-exclusion.spec.js on lines 702..712
    src/field-exclusion.spec.js on lines 818..828
    src/field-exclusion.spec.js on lines 876..886

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

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

          const config = [
            {
              tag: /^500$/u,
              unidentified: /^500$/u,
              subfields: [
    Severity: Minor
    Found in src/subfield-exclusion.spec.js and 1 other location - About 30 mins to fix
    src/field-exclusion.spec.js on lines 187..196

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

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    There are no issues that match your filters.

    Category
    Status