src/cyrillux-usemarcon-replacement.js
Function field260To264s
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
Open
function field260To264s(field, record) { // might be generic... if so, move to utils...
// As per my quick reading of usemarcon-cyrillux
if (field.tag !== '260') {
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
File cyrillux-usemarcon-replacement.js
has 288 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* cyrillux-usemarcon-replacement.js -- implement and improve https://github.com/NatLibFi/USEMARCON-Cyrillux/tree/master
*
* Author(s): Nicholas Volk <nicholas.volk@helsinki.fi>
*
Function field260To264s
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function field260To264s(field, record) { // might be generic... if so, move to utils...
// As per my quick reading of usemarcon-cyrillux
if (field.tag !== '260') {
return;
}
Function default
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
export default function () {
return {
description, fix, validate
};
Function finnishTranslationsAndMappings
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function finnishTranslationsAndMappings(value) {
return value.replace('analog', 'analoginen').
replace('approximately', 'noin').
replace('audio discs', 'äänilevyä').
replace('black and white', 'mustavalkoinen').
Function realFix
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function realFix(record) {
// Fix leader: standard fixes + update LDR/17 to '4'
fixLeader(record);
record.leader = `${record.leader.substring(0, 17)}4${record.leader.substring(18, 24)}`; // eslint-disable-line functional/immutable-data
Avoid too many return
statements within this function. Open
Open
return subfield.value;
Avoid too many return
statements within this function. Open
Open
return subfield.value.replace(/\b[Ss]\. ?a\./u, 'julkaisuaika tuntematon');
Function translateFieldToFinnish
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
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"