NatLibFi/marc-record-validators-melinda

View on GitHub

Showing 1,132 of 1,132 total issues

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

    {'tag': '094',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [{'code': 'a', 'repeatable': false}]},
Severity: Major
Found in src/melindaCustomMergeFields.js and 18 other locations - About 50 mins to fix
src/melindaCustomMergeFields.js on lines 119..123
src/melindaCustomMergeFields.js on lines 437..441
src/melindaCustomMergeFields.js on lines 803..807
src/melindaCustomMergeFields.js on lines 808..812
src/melindaCustomMergeFields.js on lines 813..817
src/melindaCustomMergeFields.js on lines 818..822
src/melindaCustomMergeFields.js on lines 828..832
src/melindaCustomMergeFields.js on lines 833..837
src/melindaCustomMergeFields.js on lines 838..842
src/melindaCustomMergeFields.js on lines 843..847
src/melindaCustomMergeFields.js on lines 848..852
src/melindaCustomMergeFields.js on lines 4900..4904
src/melindaCustomMergeFields.js on lines 4935..4939
src/melindaCustomMergeFields.js on lines 4940..4944
src/melindaCustomMergeFields.js on lines 4945..4949
src/melindaCustomMergeFields.js on lines 4968..4972
src/melindaCustomMergeFields.js on lines 5084..5088
src/melindaCustomMergeFields.js on lines 5128..5132

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

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

    {'tag': '098',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [{'code': 'a', 'repeatable': false}]},
Severity: Major
Found in src/melindaCustomMergeFields.js and 18 other locations - About 50 mins to fix
src/melindaCustomMergeFields.js on lines 119..123
src/melindaCustomMergeFields.js on lines 437..441
src/melindaCustomMergeFields.js on lines 803..807
src/melindaCustomMergeFields.js on lines 808..812
src/melindaCustomMergeFields.js on lines 813..817
src/melindaCustomMergeFields.js on lines 818..822
src/melindaCustomMergeFields.js on lines 823..827
src/melindaCustomMergeFields.js on lines 828..832
src/melindaCustomMergeFields.js on lines 833..837
src/melindaCustomMergeFields.js on lines 838..842
src/melindaCustomMergeFields.js on lines 848..852
src/melindaCustomMergeFields.js on lines 4900..4904
src/melindaCustomMergeFields.js on lines 4935..4939
src/melindaCustomMergeFields.js on lines 4940..4944
src/melindaCustomMergeFields.js on lines 4945..4949
src/melindaCustomMergeFields.js on lines 4968..4972
src/melindaCustomMergeFields.js on lines 5084..5088
src/melindaCustomMergeFields.js on lines 5128..5132

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

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

    {'tag': 'LOW',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [{'code': 'a', 'repeatable': false}]},
Severity: Major
Found in src/melindaCustomMergeFields.js and 18 other locations - About 50 mins to fix
src/melindaCustomMergeFields.js on lines 119..123
src/melindaCustomMergeFields.js on lines 437..441
src/melindaCustomMergeFields.js on lines 803..807
src/melindaCustomMergeFields.js on lines 808..812
src/melindaCustomMergeFields.js on lines 813..817
src/melindaCustomMergeFields.js on lines 818..822
src/melindaCustomMergeFields.js on lines 823..827
src/melindaCustomMergeFields.js on lines 828..832
src/melindaCustomMergeFields.js on lines 833..837
src/melindaCustomMergeFields.js on lines 838..842
src/melindaCustomMergeFields.js on lines 843..847
src/melindaCustomMergeFields.js on lines 848..852
src/melindaCustomMergeFields.js on lines 4900..4904
src/melindaCustomMergeFields.js on lines 4935..4939
src/melindaCustomMergeFields.js on lines 4940..4944
src/melindaCustomMergeFields.js on lines 4945..4949
src/melindaCustomMergeFields.js on lines 4968..4972
src/melindaCustomMergeFields.js on lines 5084..5088

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

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

    {'tag': '090',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [{'code': 'a', 'repeatable': false}]},
Severity: Major
Found in src/melindaCustomMergeFields.js and 18 other locations - About 50 mins to fix
src/melindaCustomMergeFields.js on lines 119..123
src/melindaCustomMergeFields.js on lines 437..441
src/melindaCustomMergeFields.js on lines 808..812
src/melindaCustomMergeFields.js on lines 813..817
src/melindaCustomMergeFields.js on lines 818..822
src/melindaCustomMergeFields.js on lines 823..827
src/melindaCustomMergeFields.js on lines 828..832
src/melindaCustomMergeFields.js on lines 833..837
src/melindaCustomMergeFields.js on lines 838..842
src/melindaCustomMergeFields.js on lines 843..847
src/melindaCustomMergeFields.js on lines 848..852
src/melindaCustomMergeFields.js on lines 4900..4904
src/melindaCustomMergeFields.js on lines 4935..4939
src/melindaCustomMergeFields.js on lines 4940..4944
src/melindaCustomMergeFields.js on lines 4945..4949
src/melindaCustomMergeFields.js on lines 4968..4972
src/melindaCustomMergeFields.js on lines 5084..5088
src/melindaCustomMergeFields.js on lines 5128..5132

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

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

    {'tag': '935',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [{'code': 'a', 'repeatable': true}]},
Severity: Major
Found in src/melindaCustomMergeFields.js and 18 other locations - About 50 mins to fix
src/melindaCustomMergeFields.js on lines 119..123
src/melindaCustomMergeFields.js on lines 437..441
src/melindaCustomMergeFields.js on lines 803..807
src/melindaCustomMergeFields.js on lines 808..812
src/melindaCustomMergeFields.js on lines 813..817
src/melindaCustomMergeFields.js on lines 818..822
src/melindaCustomMergeFields.js on lines 823..827
src/melindaCustomMergeFields.js on lines 828..832
src/melindaCustomMergeFields.js on lines 833..837
src/melindaCustomMergeFields.js on lines 838..842
src/melindaCustomMergeFields.js on lines 843..847
src/melindaCustomMergeFields.js on lines 848..852
src/melindaCustomMergeFields.js on lines 4900..4904
src/melindaCustomMergeFields.js on lines 4935..4939
src/melindaCustomMergeFields.js on lines 4940..4944
src/melindaCustomMergeFields.js on lines 4945..4949
src/melindaCustomMergeFields.js on lines 5084..5088
src/melindaCustomMergeFields.js on lines 5128..5132

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

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

    {'tag': '097',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [{'code': 'a', 'repeatable': false}]},
Severity: Major
Found in src/melindaCustomMergeFields.js and 18 other locations - About 50 mins to fix
src/melindaCustomMergeFields.js on lines 119..123
src/melindaCustomMergeFields.js on lines 437..441
src/melindaCustomMergeFields.js on lines 803..807
src/melindaCustomMergeFields.js on lines 808..812
src/melindaCustomMergeFields.js on lines 813..817
src/melindaCustomMergeFields.js on lines 818..822
src/melindaCustomMergeFields.js on lines 823..827
src/melindaCustomMergeFields.js on lines 828..832
src/melindaCustomMergeFields.js on lines 833..837
src/melindaCustomMergeFields.js on lines 843..847
src/melindaCustomMergeFields.js on lines 848..852
src/melindaCustomMergeFields.js on lines 4900..4904
src/melindaCustomMergeFields.js on lines 4935..4939
src/melindaCustomMergeFields.js on lines 4940..4944
src/melindaCustomMergeFields.js on lines 4945..4949
src/melindaCustomMergeFields.js on lines 4968..4972
src/melindaCustomMergeFields.js on lines 5084..5088
src/melindaCustomMergeFields.js on lines 5128..5132

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

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

    {'tag': '921',
      'repeatable': false,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [{'code': 'a', 'repeatable': false}]},
Severity: Major
Found in src/melindaCustomMergeFields.js and 18 other locations - About 50 mins to fix
src/melindaCustomMergeFields.js on lines 119..123
src/melindaCustomMergeFields.js on lines 437..441
src/melindaCustomMergeFields.js on lines 803..807
src/melindaCustomMergeFields.js on lines 808..812
src/melindaCustomMergeFields.js on lines 813..817
src/melindaCustomMergeFields.js on lines 818..822
src/melindaCustomMergeFields.js on lines 823..827
src/melindaCustomMergeFields.js on lines 828..832
src/melindaCustomMergeFields.js on lines 833..837
src/melindaCustomMergeFields.js on lines 838..842
src/melindaCustomMergeFields.js on lines 843..847
src/melindaCustomMergeFields.js on lines 848..852
src/melindaCustomMergeFields.js on lines 4935..4939
src/melindaCustomMergeFields.js on lines 4940..4944
src/melindaCustomMergeFields.js on lines 4945..4949
src/melindaCustomMergeFields.js on lines 4968..4972
src/melindaCustomMergeFields.js on lines 5084..5088
src/melindaCustomMergeFields.js on lines 5128..5132

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

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

    {'tag': '977',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [{'code': 'a', 'repeatable': false}]},
Severity: Major
Found in src/melindaCustomMergeFields.js and 18 other locations - About 50 mins to fix
src/melindaCustomMergeFields.js on lines 119..123
src/melindaCustomMergeFields.js on lines 437..441
src/melindaCustomMergeFields.js on lines 803..807
src/melindaCustomMergeFields.js on lines 808..812
src/melindaCustomMergeFields.js on lines 813..817
src/melindaCustomMergeFields.js on lines 818..822
src/melindaCustomMergeFields.js on lines 823..827
src/melindaCustomMergeFields.js on lines 828..832
src/melindaCustomMergeFields.js on lines 833..837
src/melindaCustomMergeFields.js on lines 838..842
src/melindaCustomMergeFields.js on lines 843..847
src/melindaCustomMergeFields.js on lines 848..852
src/melindaCustomMergeFields.js on lines 4900..4904
src/melindaCustomMergeFields.js on lines 4935..4939
src/melindaCustomMergeFields.js on lines 4940..4944
src/melindaCustomMergeFields.js on lines 4945..4949
src/melindaCustomMergeFields.js on lines 4968..4972
src/melindaCustomMergeFields.js on lines 5128..5132

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

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

    {'tag': '930',
      'repeatable': true,
      'fieldType': 'dataField',
      'indicators': {'ind1': ' ', 'ind2': ' '},
      'subfields': [{'code': 'a', 'repeatable': false}]},
Severity: Major
Found in src/melindaCustomMergeFields.js and 18 other locations - About 50 mins to fix
src/melindaCustomMergeFields.js on lines 119..123
src/melindaCustomMergeFields.js on lines 437..441
src/melindaCustomMergeFields.js on lines 803..807
src/melindaCustomMergeFields.js on lines 808..812
src/melindaCustomMergeFields.js on lines 813..817
src/melindaCustomMergeFields.js on lines 818..822
src/melindaCustomMergeFields.js on lines 823..827
src/melindaCustomMergeFields.js on lines 828..832
src/melindaCustomMergeFields.js on lines 833..837
src/melindaCustomMergeFields.js on lines 838..842
src/melindaCustomMergeFields.js on lines 843..847
src/melindaCustomMergeFields.js on lines 848..852
src/melindaCustomMergeFields.js on lines 4900..4904
src/melindaCustomMergeFields.js on lines 4935..4939
src/melindaCustomMergeFields.js on lines 4945..4949
src/melindaCustomMergeFields.js on lines 4968..4972
src/melindaCustomMergeFields.js on lines 5084..5088
src/melindaCustomMergeFields.js on lines 5128..5132

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

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

Avoid deeply nested control flow statements.
Open

        if (isNaN(subField.code) && res.special.secondLastIfLast !== subField.code) { // eslint-disable-line functional/no-conditional-statements
          lastSubField = subField;
        } // Not control field
Severity: Major
Found in src/ending-punctuation.js - About 45 mins to fix

    Avoid deeply nested control flow statements.
    Open

            if (typeof res.special.last !== 'undefined' && res.special.secondLastIfLast === subField.code) { // eslint-disable-line functional/no-conditional-statements
              normalPuncRules(subField, res.special.last, tag, true, false);
            } // Strict because this field should not be abbreviation
    Severity: Major
    Found in src/ending-punctuation.js - About 45 mins to fix

      Avoid deeply nested control flow statements.
      Open

              if (res.special.ifInd2 && res.special.ifInd2.includes(field.ind2)) { // eslint-disable-line functional/no-conditional-statements
                normalPuncRules(lastSubField, res.special.ifBoth, tag, true, res.special.ifLastCharNot);
      
                // Matches execption to special rule, noPuncIfInd2 (likely with value 4, that indicates copyright mark)
              } else if (res.special.noPuncIfInd2 && field.ind2 && res.special.noPuncIfInd2.includes(field.ind2)) { // eslint-disable-line functional/no-conditional-statements
      Severity: Major
      Found in src/ending-punctuation.js - About 45 mins to fix

        Avoid deeply nested control flow statements.
        Open

            } else if (res.special.termField) {
              lastSubField = findLastSubfield(field);
        
              if (lastSubField) {
                const languageField = field.subfields.find(({code}) => code === res.special.termField);
        Severity: Major
        Found in src/ending-punctuation.js - About 45 mins to fix

          Function mergeField has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          export function mergeField(baseRecord, sourceRecord, sourceField, config) {
            nvdebug(`SELF: ${fieldToString(sourceField)}`, debugDev);
          
            sourceField.mergeCandidate = true; // eslint-disable-line functional/immutable-data
            // skip duplicates and special cases:
          Severity: Minor
          Found in src/merge-fields/mergeField.js - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function splitToNameAndQualifierAndProcessName has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          export function splitToNameAndQualifierAndProcessName(name) {
            //const nameOnly = name.replace(/(?: \([^)]+\)| abp?| Kustannus| Kustannus Oy|, kustannusosakeyhtiö| oyj?| ry)$/ugi, '');
            const [qualifierlessName, qualifier] = splitToNameAndQualifier(name);
          
            const [prefix, basename, suffix] = stripPrefixAndSuffix(qualifierlessName);
          Severity: Minor
          Found in src/merge-fields/counterpartField.js - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

          Function mergableIndicator1 has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

          export function mergableIndicator1(field1, field2, config) {
            // Indicators are identical:
            if (field1.ind1 === field2.ind1) {
              return true;
            }
          Severity: Minor
          Found in src/merge-fields/mergableIndicator.js - About 45 mins to fix

          Cognitive Complexity

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

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

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

          Further reading

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

          export default function () {
          
            return {
              description, validate, fix
            };
          Severity: Minor
          Found in src/merge-fields/index.js - About 45 mins 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

          Avoid deeply nested control flow statements.
          Open

                    if (!mergedPrintData) {
                      return []; // reason for for-loops: exit function from within nested loops
                    }
          Severity: Major
          Found in src/mergeField500Lisapainokset.js - About 45 mins to fix

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

                  fieldA.subfields.every(aSf => fieldB.subfields.some(bSf => aSf.code === bSf.code && aSf.value === bSf.value)));
            Severity: Minor
            Found in src/duplicates-ind1.js and 1 other location - About 45 mins to fix
            src/urn.js on lines 142..142

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

            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

              if (relevantTargetSubfields.some(sf => sf.code === candSubfieldData.code && sf.value === candSubfieldData.punctuationlessValue)) {
                return true;
              }
            Severity: Minor
            Found in src/merge-fields/mergeOrAddSubfield.js and 1 other location - About 45 mins to fix
            src/merge-fields/mergeOrAddSubfield.js on lines 94..96

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

            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