NatLibFi/marc-record-validators-melinda

View on GitHub

Showing 830 of 830 total issues

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

    const recordValid = new MarcRecord({
      leader: '',
      fields: [
        {
          tag: '001',
Severity: Major
Found in src/field-structure.spec.js and 4 other locations - About 4 hrs to fix
src/field-structure.spec.js on lines 148..179
src/field-structure.spec.js on lines 353..384
src/field-structure.spec.js on lines 502..533
src/field-structure.spec.js on lines 535..566

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

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 record = new MarcRecord({
        fields: [
          {
            tag: '001',
            value: '123456'
Severity: Major
Found in src/resolvable-ext-references-melinda.spec.js and 1 other location - About 4 hrs to fix
src/resolvable-ext-references-melinda.spec.js on lines 102..140

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

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

    const recordValid = new MarcRecord({
      leader: '',
      fields: [
        {
          tag: '001',
Severity: Major
Found in src/field-structure.spec.js and 4 other locations - About 4 hrs to fix
src/field-structure.spec.js on lines 248..279
src/field-structure.spec.js on lines 353..384
src/field-structure.spec.js on lines 502..533
src/field-structure.spec.js on lines 535..566

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

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 record = new MarcRecord({
        fields: [
          {
            tag: '001',
            value: '123456'
Severity: Major
Found in src/resolvable-ext-references-melinda.spec.js and 1 other location - About 4 hrs to fix
src/resolvable-ext-references-melinda.spec.js on lines 50..88

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

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

    const recordValid = new MarcRecord({
      leader: '63ab75sfoo122myhgh',
      fields: [
        {
          tag: '001',
Severity: Major
Found in src/field-structure.spec.js and 4 other locations - About 4 hrs to fix
src/field-structure.spec.js on lines 148..179
src/field-structure.spec.js on lines 248..279
src/field-structure.spec.js on lines 353..384
src/field-structure.spec.js on lines 535..566

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

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

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

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

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

Refactorings

Further Reading

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

    it('Finds the record valid', async () => {
      const validator = await validatorFactory();
      const record = new MarcRecord({
        fields: [
          {
Severity: Major
Found in src/unicode-decomposition.spec.js and 1 other location - About 4 hrs to fix
src/identical-fields.spec.js on lines 18..36

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

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

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

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

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

Refactorings

Further Reading

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

    it('Finds the record valid', async () => {
      const validator = await validatorFactory();
      const record = new MarcRecord({
        fields: [
          {
Severity: Major
Found in src/identical-fields.spec.js and 1 other location - About 4 hrs to fix
src/unicode-decomposition.spec.js on lines 22..39

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

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

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

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

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

Refactorings

Further Reading

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

  it('Creates a validator', async () => {
    const validator = await validatorFactory(/^520$/u);

    expect(validator)
      .to.be.an('object')
Severity: Major
Found in src/item-language.spec.js and 1 other location - About 4 hrs to fix
src/duplicates-ind1.spec.js on lines 24..33

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

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

async function testValidatorFactory() {
  const validator = await validatorFactory(/^500$/u);

  expect(validator)
    .to.be.an('object')
Severity: Major
Found in src/duplicates-ind1.spec.js and 1 other location - About 4 hrs to fix
src/item-language.spec.js on lines 10..19

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

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

  function mapFieldToCyrillicField880(field, occurrenceNumber) {
    const subfields = [
      {code: '6', value: `${field.tag}-${occurrenceNumber}`},
      ...field.subfields.map(sf => clone(sf)),
      {code: '9', value: 'CYRILLIC <TRANS>'}
Severity: Major
Found in src/cyrillux.js and 1 other location - About 3 hrs to fix
src/cyrillux.js on lines 149..158

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

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

  function mapFieldToSfs4900Field880(field, occurrenceNumber) {

    const subfields = [
      {code: '6', value: `${field.tag}-${occurrenceNumber}`},
      ...field.subfields.map(sf => mapSubfieldToSfs4900(sf)),
Severity: Major
Found in src/cyrillux.js and 1 other location - About 3 hrs to fix
src/cyrillux.js on lines 139..147

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

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 97 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export default function () {

  return {
    description, validate, fix
  };
Severity: Major
Found in src/fix-33X.js - About 3 hrs to fix

    Function default has 97 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function (config) {
      if (!Array.isArray(config)) {
        throw new TypeError('Configuration array not provided');
      }
    
    
    Severity: Major
    Found in src/field-structure.js - About 3 hrs to fix

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

            const record = new MarcRecord({
              fields: [
                {
                  tag: '001',
                  value: '100'
      Severity: Major
      Found in src/sort-tags.spec.js and 1 other location - About 3 hrs to fix
      src/sort-tags.spec.js on lines 60..93

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

      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

        function fixCountryCode(field008) {
          const originalCountryCode = getCountryCodeFromField008(field008);
          const modifiedCountryCode = deprecatedCountryCodeToCurrentCountryCode(originalCountryCode);
          if (originalCountryCode !== modifiedCountryCode && modifiedCountryCode.length === 3) {
            field008.value = `${field008.value.substring(0, 15)}${modifiedCountryCode}${field008.value.substring(18)}`; // eslint-disable-line functional/immutable-data
      Severity: Major
      Found in src/fix-country-codes.js and 1 other location - About 3 hrs to fix
      src/fix-language-codes.js on lines 86..93

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

      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

        function fixLanguageField008(field008) {
          const originalLanguage = getLanguageFromField008(field008);
          const modifiedLanguage = deprecatedLanguageToCurrentLanguage(originalLanguage);
          if (originalLanguage !== modifiedLanguage && modifiedLanguage.length === 3) {
            field008.value = `${field008.value.substring(0, 35)}${modifiedLanguage}${field008.value.substring(38)}`; // eslint-disable-line functional/immutable-data
      Severity: Major
      Found in src/fix-language-codes.js and 1 other location - About 3 hrs to fix
      src/fix-country-codes.js on lines 53..60

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

      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 record = new MarcRecord({
              fields: [
                {
                  tag: '008',
                  value: 'bar'
      Severity: Major
      Found in src/sort-tags.spec.js and 1 other location - About 3 hrs to fix
      src/sort-tags.spec.js on lines 20..53

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

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

            it('Repairs the invalid record - Add punc $i (last)', async () => {
              const validator = await validatorFactory();
              const result = await validator.fix(recordInvalidMissingI);
              expect(recordInvalidMissingI.equalsTo(recordValid)).to.eql(true);
              expect(result).to.eql({
      Severity: Major
      Found in src/ending-punctuation.spec.js and 11 other locations - About 3 hrs to fix
      src/ending-punctuation.spec.js on lines 220..229
      src/ending-punctuation.spec.js on lines 431..440
      src/ending-punctuation.spec.js on lines 611..620
      src/ending-punctuation.spec.js on lines 786..795
      src/ending-punctuation.spec.js on lines 1044..1053
      src/ending-punctuation.spec.js on lines 1210..1219
      src/ending-punctuation.spec.js on lines 1486..1495
      src/ending-punctuation.spec.js on lines 1790..1799
      src/ending-punctuation.spec.js on lines 2226..2235
      src/ending-punctuation.spec.js on lines 2407..2416
      src/ending-punctuation.spec.js on lines 2533..2542

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

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

            it('Repairs the invalid record - 647 Fast, removes double punc $d', async () => {
              const validator = await validatorFactory();
              const result = await validator.fix(recordInvalid647FastEndPunc);
              expect(recordInvalid647FastEndPunc.equalsTo(recordValid647FastEndPunc)).to.eql(true);
              expect(result).to.eql({
      Severity: Major
      Found in src/ending-punctuation.spec.js and 11 other locations - About 3 hrs to fix
      src/ending-punctuation.spec.js on lines 220..229
      src/ending-punctuation.spec.js on lines 431..440
      src/ending-punctuation.spec.js on lines 611..620
      src/ending-punctuation.spec.js on lines 786..795
      src/ending-punctuation.spec.js on lines 1044..1053
      src/ending-punctuation.spec.js on lines 1210..1219
      src/ending-punctuation.spec.js on lines 1373..1382
      src/ending-punctuation.spec.js on lines 1486..1495
      src/ending-punctuation.spec.js on lines 2226..2235
      src/ending-punctuation.spec.js on lines 2407..2416
      src/ending-punctuation.spec.js on lines 2533..2542

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

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

            it('Repairs the invalid record - Add punc $a (only)', async () => {
              const validator = await validatorFactory();
              const result = await validator.fix(recordInvalidA);
              expect(recordInvalidA.equalsTo(recordInvalidA)).to.eql(true);
              expect(result).to.eql({
      Severity: Major
      Found in src/ending-punctuation.spec.js and 11 other locations - About 3 hrs to fix
      src/ending-punctuation.spec.js on lines 220..229
      src/ending-punctuation.spec.js on lines 431..440
      src/ending-punctuation.spec.js on lines 611..620
      src/ending-punctuation.spec.js on lines 786..795
      src/ending-punctuation.spec.js on lines 1210..1219
      src/ending-punctuation.spec.js on lines 1373..1382
      src/ending-punctuation.spec.js on lines 1486..1495
      src/ending-punctuation.spec.js on lines 1790..1799
      src/ending-punctuation.spec.js on lines 2226..2235
      src/ending-punctuation.spec.js on lines 2407..2416
      src/ending-punctuation.spec.js on lines 2533..2542

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

      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