Function recordDisambiguateSharedSubfield6OccurrenceNumbers
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
function recordDisambiguateSharedSubfield6OccurrenceNumbers(record) {
const sharedOccurrenceNumberFields = recordGetSharedOccurrenceNumbers(record);
if (sharedOccurrenceNumberFields.length < 2) {
return;
}
Function recordDisambiguateSharedSubfield6OccurrenceNumbers
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function recordDisambiguateSharedSubfield6OccurrenceNumbers(record) {
const sharedOccurrenceNumberFields = recordGetSharedOccurrenceNumbers(record);
if (sharedOccurrenceNumberFields.length < 2) {
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 recordResetSubfield6OccurrenceNumbers
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function recordResetSubfield6OccurrenceNumbers(record) { // Remove gaps
/* eslint-disable */
let currentInt = 1;
let oldtoNewCache = {};
Function default
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function () {
return {
description: 'Reindex occurrence numbers in $6 subfield so that they start from 01 and end in NN',
validate, fix
};
Function recordResetSubfield6OccurrenceNumbers
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export function recordResetSubfield6OccurrenceNumbers(record) { // Remove gaps
/* eslint-disable */
let currentInt = 1;
let oldtoNewCache = {};
- 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
Avoid too many return
statements within this function. Open
return true;
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"