Showing 1,132 of 1,132 total issues
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));
- Read upRead up
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 normalizeEditionStatement
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function normalizeEditionStatement(originalValue) {
const value = originalValue;
// As normalization tries to translate things info Finnish, use this for similarity check only!
if (value.match(/^[1-9][0-9]*(?:\.|:a|nd|rd|st|th) (?:ed\.?|edition|p\.?|painos|uppl\.?|upplagan)[.\]]*$/ui)) {
- Read upRead up
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 getAlternativeNamesFrom9XX
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function getAlternativeNamesFrom9XX(record, field) {
// Should we support 6XX and 8XX as well? Prolly not...
if (!field.tag.match(/^(?:100|110|111|600|610|611|700|710|711)$/u)) {
return [];
}
- Read upRead up
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 controlSubfieldsPermitMerge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function controlSubfieldsPermitMerge(baseField, sourceField) {
// Check $w, $0, $1, $2 (which isn't an identifier per se, but the sama logic can be applied)
if (!controlSubfieldsContainingIdentifier.every(subfieldCode => controlSubfieldContainingIdentifierPermitsMerge(baseField, sourceField, subfieldCode))) {
//debug(' control subfields with identifiers failed');
return false;
- Read upRead up
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));
- Read upRead up
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 syntacticallyMergablePair
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function syntacticallyMergablePair(baseField, sourceField, config) {
// Indicators must typically be equal (there are exceptions such as non-filing characters though):
if (!mergableIndicator1(baseField, sourceField, config)) {
nvdebug(`non-mergable (reason: indicator1): ${JSON.stringify(config)}`, debugDev);
return false;
- Read upRead up
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',
- Read upRead up
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 replaceEntrysBirthAndDeathYear
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function replaceEntrysBirthAndDeathYear(targetField, candSubfield, relevantSubfields) {
if (birthYearAndDeathYear.test(candSubfield.value)) {
if (onlyBirthYear.test(relevantSubfields[0].value) && parseInt(relevantSubfields[0].value, 10) === parseInt(candSubfield.value, 10)) {
relevantSubfields[0].value = candSubfield.value; // eslint-disable-line functional/immutable-data
return true;
- Read upRead up
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));
- Read upRead up
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 controlSubfieldContainingIdentifierPermitsMerge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function controlSubfieldContainingIdentifierPermitsMerge(field1, field2, subfieldCode) {
if (!fieldHasSubfield(field1, subfieldCode, null) || !fieldHasSubfield(field2, subfieldCode, null)) {
return true;
}
- Read upRead up
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 controlSubfield5PermitsMerge
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function controlSubfield5PermitsMerge(field1, field2) {
// field1.$5 XOR field2.$5 means false, NEITHER and BOTH mean true, regardless of value
if (!fieldHasSubfield(field1, '5')) {
if (!fieldHasSubfield(field2, '5')) {
return true; // If neither one has $5, it's ok to merge
- Read upRead up
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;
}
- Read upRead up
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"