Showing 45 of 81 total issues
Function to
has a Cognitive Complexity of 186 (exceeds 5 allowed). Consider refactoring. Open
export function to(record, useCrForContinuingResource = false) {
const MAX_FIELD_LENGTH = 2000;
const SPLIT_MAX_FIELD_LENGTH = 1000;
- 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 to
has 261 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function to(record, useCrForContinuingResource = false) {
const MAX_FIELD_LENGTH = 2000;
const SPLIT_MAX_FIELD_LENGTH = 1000;
Function from
has a Cognitive Complexity of 53 (exceeds 5 allowed). Consider refactoring. Open
export function from(dataStr, validationOptions = {}) {
const leader = dataStr.substring(0, 24);
const record = {
leader,
fields: []
- 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 aleph-sequential.js
has 466 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* eslint-disable max-lines */
/**
*
* @licstart The following is the entire license notice for the JavaScript code in this file.
*
Function formatDatafield
has 168 lines of code (exceeds 25 allowed). Consider refactoring. Open
function formatDatafield(field) {
let subfieldLines; // eslint-disable-line functional/no-let
const ind1 = field.ind1 && field.ind1.length > 0 ? field.ind1 : ' ';
const ind2 = field.ind2 && field.ind2.length > 0 ? field.ind2 : ' ';
const header = `${id} ${field.tag}${ind1}${ind2} L `;
Function run
has 152 lines of code (exceeds 25 allowed). Consider refactoring. Open
async function run() {
const VALIDATION_OPTIONS_USAGE = `Validation options:
111 => {fields: true, subfields: true, subfieldValues: true}
010 => {fields: false, subfields: true, subfieldValues: false}
000 => {fields: false, subfields: false, subfieldValues: false}`;
Function reduceToLines
has 144 lines of code (exceeds 25 allowed). Consider refactoring. Open
function reduceToLines(result, subfield, index, arr) {
let code; // eslint-disable-line functional/no-let
let sliceOffset; // eslint-disable-line functional/no-let
let slicedSegment; // eslint-disable-line functional/no-let
const tempLength = result.temp ? result.temp.length : 0;
Function from
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
export function from(data, validationOptions = {}) {
let i = 0; // eslint-disable-line functional/no-let
const lines = data.split('\n').filter(l => l.length > 0);
// eslint-disable-next-line functional/no-loop-statements
- 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 iterate
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
function iterate(segment, firstCall) {
const HYPHEN = 45;
const SPACE = 32;
const CARET = 94;
const DOLLAR = 36;
Function from
has 109 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function from(data, validationOptions = {}) {
let i = 0; // eslint-disable-line functional/no-let
const lines = data.split('\n').filter(l => l.length > 0);
// eslint-disable-next-line functional/no-loop-statements
Function from
has 107 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function from(dataStr, validationOptions = {}) {
const leader = dataStr.substring(0, 24);
const record = {
leader,
fields: []
Function reader
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function reader(stream, validationOptions = {}, genF001fromSysNo = false) {
const emitter = new class extends EventEmitter { }();
start();
return emitter;
Function getSliceOffset
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getSliceOffset(arr) {
const offset = findSeparatorOffset(arr) || findPeriodOffset(arr) || findSpaceOffset(arr) || SPLIT_MAX_FIELD_LENGTH;
return offset;
Function start
has 77 lines of code (exceeds 25 allowed). Consider refactoring. Open
function start() {
let charbuffer = ''; // eslint-disable-line functional/no-let
const linebuffer = []; // eslint-disable-line functional/no-let
let count = 0; // eslint-disable-line functional/no-let
Function run
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
async function run() {
const VALIDATION_OPTIONS_USAGE = `Validation options:
111 => {fields: true, subfields: true, subfieldValues: true}
010 => {fields: false, subfields: true, subfieldValues: false}
000 => {fields: false, subfields: false, subfieldValues: 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 from
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function from(xmlString, validationOptions = {}) {
const parser = new DOMParser();
const record = new MarcRecord();
debug(`Parsing from xmlstring`);
Function to
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function to(record) {
//let tag; // eslint-disable-line functional/no-let
//let ind1; // eslint-disable-line functional/no-let
//let ind2; // eslint-disable-line functional/no-let
Function reader
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
export function reader(stream, validationOptions = {}) {
const emitter = new class extends EventEmitter { }();
start();
return emitter;
- 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 getService
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getService(type) {
if (type === 'text') {
return {
reader: Text.reader,
serialize: Text.to,
Function reader
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function reader(stream, validationOptions = {}) {
const emitter = new class extends EventEmitter { }();
start();
return emitter;