Showing 258 of 822 total issues
File ending-punctuation.spec.js
has 2265 lines of code (exceeds 250 allowed). Consider refactoring. Open
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import {MarcRecord} from '@natlibfi/marc-record';
import validatorFactory from '../src/ending-punctuation';
Function default
has a Cognitive Complexity of 156 (exceeds 5 allowed). Consider refactoring. Open
export default function () {
return {
description, validate, fix
};
- 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 104 (exceeds 5 allowed). Consider refactoring. Open
export default function () {
return {
description, validate, fix
};
- 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 field-exclusion.spec.js
has 796 lines of code (exceeds 250 allowed). Consider refactoring. Open
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import {MarcRecord} from '@natlibfi/marc-record';
import validatorFactory from '../src/field-exclusion';
Function validateField
has a Cognitive Complexity of 85 (exceeds 5 allowed). Consider refactoring. Open
function validateField(field, linkedTag, fix, message) {
// This is used to find last subfield that should have punctuation
function findLastSubfield(field) {
const subfields = field.subfields.filter(sf => isNaN(sf.code) && 'value' in sf);
return subfields.slice(-1).shift();
- 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 315 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function () {
return {
description, validate, fix
};
File ending-punctuation-conf.js
has 680 lines of code (exceeds 250 allowed). Consider refactoring. Open
// Const finnishTerms = ['ysa', 'yso', 'kassu', 'seko', 'valo', 'kulo', 'puho', 'oiko', 'mero', 'liito', 'fast', 'allars', 'kaunokki'];
const finnishTerms = [
/^ysa$/u,
/^yso$/u,
/^kassu$/u,
Function default
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
export default async function (tagPattern, treshold = 0.9) {
const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda/item-language');
const cldFactory = await loadCLD();
if (tagPattern instanceof RegExp) {
- 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 field-structure.spec.js
has 550 lines of code (exceeds 250 allowed). Consider refactoring. Open
import chai from 'chai';
import chaiAsPromised from 'chai-as-promised';
import {MarcRecord} from '@natlibfi/marc-record';
import validatorFactory from '../src/field-structure';
Function default
has 224 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function () {
function readPunctuationRulesFromJSON(recordType) {
const json = getRules(recordType);
const rules = json.filter(row => row.selector !== '').map(row => {
const {selector, namePortion, description, portion, preceedingPunctuation, exceptions} = row;
Function default
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
export default function () {
function readPunctuationRulesFromJSON(recordType) {
const json = getRules(recordType);
const rules = json.filter(row => row.selector !== '').map(row => {
const {selector, namePortion, description, portion, preceedingPunctuation, exceptions} = row;
- 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 172 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function () {
return {
description, validate, fix
};
File subfield-exclusion.spec.js
has 453 lines of code (exceeds 250 allowed). Consider refactoring. Open
import {expect} from 'chai';
//import chaiAsPromised from 'chai-as-promised';
import {MarcRecord} from '@natlibfi/marc-record';
import validatorFactory from '../src/subfield-exclusion';
File fix-33X.js
has 442 lines of code (exceeds 250 allowed). Consider refactoring. Open
//import createDebugLogger from 'debug';
import clone from 'clone';
import {fieldToString, getCatalogingLanguage, nvdebug} from './utils';
import {map336CodeToTerm, map337CodeToTerm, map338CodeToTerm} from './field33XUtils';
File bib.js
has 420 lines of code (exceeds 250 allowed). Consider refactoring. Open
const bibRules =
[
{
selector: '[1678]00',
namePortion: '$a',
Function default
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
export default function (isLegalDeposit = false, useMelindaTemp = true) {
const debug = createDebugLogger('@natlibfi/marc-record-validators-melinda:urn');
const debugData = debug.extend('data');
// We should check that the f856 with URN has second indicator '0' (Resource), ' ' (No information provided) or '8' (No display constant generated)
- 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 validateField
has 138 lines of code (exceeds 25 allowed). Consider refactoring. Open
function validateField(field, linkedTag, fix, message) {
// This is used to find last subfield that should have punctuation
function findLastSubfield(field) {
const subfields = field.subfields.filter(sf => isNaN(sf.code) && 'value' in sf);
return subfields.slice(-1).shift();
Function deriveIndividualDeletables
has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring. Open
function deriveIndividualDeletables(record) {
const todoList = record.fields.map(f => fieldToString(f));
//const finishedRecord = encodingLevelIsBetterThanPrepublication(getEncodingLevel(record));
const deletableStringsArray = processTodoList(todoList);
- 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 36 (exceeds 5 allowed). Consider refactoring. Open
export default function () {
return {
description, validate, fix
};
- 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 punctuation2.js
has 381 lines of code (exceeds 250 allowed). Consider refactoring. Open
/*
* punctuation.js -- try and fix a marc field punctuation
*
* Author(s): Nicholas Volk <nicholas.volk@helsinki.fi>
*