Showing 41 of 64 total issues
ParsedHedGroup
has 41 functions (exceeds 20 allowed). Consider refactoring. Open
export class ParsedHedGroup extends ParsedHedSubstring {
static SPECIAL_SHORT_TAGS = new Set(['Definition', 'Def', 'Def-expand', 'Onset', 'Offset', 'Inset'])
/**
* The parsed HED tags in the HED tag group.
Function convertTagToLong
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
export const convertTagToLong = function (schema, hedTag, hedString, offset) {
const mapping = schema.mapping
if (hedTag.startsWith('/')) {
hedTag = hedTag.slice(1)
- 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 splitHedString
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
export function splitHedString(hedString) {
const resultPositions = []
let currentSpacing = 0
let insideDelimiter = true
let startPosition = -1
- 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 validateUnits
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
export const validateUnits = function (originalTagUnitValue, tagUnitClassUnits, hedSchemaAttributes) {
const validUnits = getAllUnits(hedSchemaAttributes)
validUnits.sort((first, second) => {
return second.length - first.length
})
- 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 validateUnits
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
validateUnits(tag) {
const originalTagUnitValue = tag.originalTagName
const tagUnitClassUnits = tag.validUnits
const validUnits = tag.schema.entries.allUnits
const unitStrings = Array.from(validUnits.keys())
- 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
Hed3Validator
has 25 functions (exceeds 20 allowed). Consider refactoring. Open
export class Hed3Validator extends HedValidator {
/**
* The parsed definitions.
*
* @type {Map<string, ParsedHedGroup>}
Function checkDefinitionGroupSyntax
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
checkDefinitionGroupSyntax(tagGroup) {
if (!tagGroup.isDefinitionGroup) {
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 findDelimiterIssuesInHedString
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
const findDelimiterIssuesInHedString = function (hedString) {
const issues = []
let lastNonEmptyValidCharacter = ''
let lastNonEmptyValidIndex = 0
let currentTag = ''
- 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 checkIfTagUnitClassUnitsAreValid
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
checkIfTagUnitClassUnitsAreValid(tag) {
if (tag.existsInSchema || !tag.hasUnitClass) {
return
}
const tagUnitClasses = tag.unitClasses
- 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 populateUnitClassUnitsDictionary
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
populateUnitClassUnitsDictionary(unitClassElements) {
this.unitClasses = {}
this.unitClassAttributes = {}
this.unitAttributes = {}
for (const unitClassKey of unitClassDictionaryKeys) {
- 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 populateUnitModifierDictionaries
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
populateUnitModifierDictionaries() {
this.unitModifiers = {}
const unitModifierElements = this.getElementsByName(unitModifierElement)
if (unitModifierElements.length === 0) {
this.hasUnitModifiers = 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 getValidDerivativeUnits
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
const getValidDerivativeUnits = function (unit, hedSchemaAttributes) {
const pluralUnits = [unit]
const isUnitSymbol = hedSchemaAttributes.unitAttributes[unitSymbolType][unit] !== undefined
if (hedSchemaAttributes.hasUnitModifiers && !isUnitSymbol) {
pluralUnits.push(pluralize.plural(unit))
- 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 _checkStandalonePlaceholderStringSyntaxInGroup
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
_checkStandalonePlaceholderStringSyntaxInGroup(tags, standalonePlaceholders) {
let firstStandaloneTag
for (const tag of tags) {
const tagString = tag.formattedTag
const tagPlaceholders = getCharacterCount(tagString, '#')
- 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 createParsedTags
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
const createParsedTags = function (hedString, hedSchemas, tagSpecs, groupSpecs) {
const conversionIssues = []
const syntaxIssues = []
const ParsedHedTagClass = generationToClass[hedSchemas.generation]
- 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 _spliceSubstring
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
_spliceSubstring(substring) {
const newData = []
if (substring instanceof ParsedHedColumnSplice) {
const substitution = this._spliceTemplate(substring)
if (substitution === null) {
- 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 convertTagToShort
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
export const convertTagToShort = function (schema, hedTag, hedString, offset) {
const mapping = schema.mapping
if (hedTag.startsWith('/')) {
hedTag = hedTag.slice(1)
- 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 checkIfTagUnitClassUnitsAreValid
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
checkIfTagUnitClassUnitsAreValid(tag) {
if (tag.existsInSchema || !tag.hasUnitClass) {
return
}
const [foundUnit, validUnit, value] = this.validateUnits(tag)
- 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 _validateSidecarStrings
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_validateSidecarStrings(sidecar) {
const issues = []
const categoricalOptions = {
checkForWarnings: 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 _checkDefinitionPlaceholderStringSyntaxInGroup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
_checkDefinitionPlaceholderStringSyntaxInGroup(tagGroup) {
// Count of placeholders within this Definition group.
let definitionPlaceholders = 0
const definitionHasPlaceholder = tagGroup.definitionValue === '#'
const definitionName = tagGroup.definitionName
- 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
Consider simplifying this complex logical expression. Open
if (settingsArg === Object(settingsArg)) {
settings = {
checkForWarnings: settingsArg.checkForWarnings ?? false,
expectValuePlaceholderString: settingsArg.expectValuePlaceholderString ?? false,
definitionsAllowed: settingsArg.definitionsAllowed ?? 'yes',