NatLibFi/marc-record-validators-melinda

View on GitHub

Showing 830 of 830 total issues

Function firstFieldHasBetterPrepubEncodingLevel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function firstFieldHasBetterPrepubEncodingLevel(field1, field2) {
  if (fieldRefersToKoneellisestiTuotettuTietue(field2)) {
    return false;
  }
  if (fieldRefersToKoneellisestiTuotettuTietue(field1)) {
Severity: Minor
Found in src/prepublicationUtils.js - About 25 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 recordFixSubfield6OccurrenceNumbers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function recordFixSubfield6OccurrenceNumbers(record) {
  const fieldsContainingSubfield6 = record.fields.filter(field => fieldHasSubfield(field, '6'));
  const orphanedFields = getOrphanedFields(fieldsContainingSubfield6);

  orphanedFields.forEach(field => fieldFixOrphanedSubfields(field));
Severity: Minor
Found in src/resolveOrphanedSubfield6s.js - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function () {

  return {
    description: 'Normalizes indicator values',
    validate, fix
Severity: Minor
Found in src/indicator-fixes.js - About 25 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 ruleAppliesToNextSubfield has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function ruleAppliesToNextSubfield(rule, nextSubfield) {
  if (!('followedBy' in rule)) { // Return true, if we are not interested in the next subfield
    return true;
  }
  // The '#' existence check applies only to the RHS field. LHS always exists.
Severity: Minor
Found in src/punctuation2.js - About 25 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 deriveInferiorChains has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function deriveInferiorChains(fields, record) {
  //nvdebug(`======= GOT ${fields.length} FIELDS TO CHAINIFY`);
  const hash = {};

  fields.forEach(f => fieldToChainToDeletables(f));
Severity: Minor
Found in src/removeInferiorDataFields.js - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function () {
  return {
    description: 'Handles empty fields',
    validate,
    fix
Severity: Minor
Found in src/empty-fields.js - About 25 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 acceptFieldsWithSubfield8 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function acceptFieldsWithSubfield8(fieldsWithSubfield8, requireSingleTag = false) {
  const linkingNumbers = fieldsGetAllSubfield8LinkingNumbers(fieldsWithSubfield8);
  if (linkingNumbers.some(linkingNumber => anomaly8(linkingNumber))) {
    return false;
  }
Severity: Minor
Found in src/removeDuplicateDataFields.js - About 25 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 recordGetNumberOfUniqueSubfield6OccurrenceNumbers has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function recordGetNumberOfUniqueSubfield6OccurrenceNumbers(record) {
  // Calculates the number of used different occurrence numbers
  /* eslint-disable */
  let indexArray = [];
  record.fields.forEach(field => gatherFieldData(field));
Severity: Minor
Found in src/reindexSubfield6OccurenceNumbers.js - About 25 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 translateFieldToFinnish has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function translateFieldToFinnish(field) {
  if (!['020', '300'].includes(field.tag)) {
    return;
  }
  field.subfields?.forEach(sf => translateSubfieldToFinnish(sf));
Severity: Minor
Found in src/cyrillux-usemarcon-replacement.js - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function (tagPatterns) {
  if (Array.isArray(tagPatterns)) {
    return {
      description:
        'Checks whether the configured fields are present in the record',
Severity: Minor
Found in src/fields-present.js - About 25 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

Severity
Category
Status
Source
Language