Showing 41 of 64 total issues
Function parseTags
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
parseTags() {
const [tags, tagElements] = this.getAllTags()
const lowercaseTags = tags.map(lc)
this.tags = new Set(lowercaseTags)
const [booleanAttributeDefinitions, valueAttributeDefinitions] = this._parseAttributeElements(
- 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 checkIfTagIsValid
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
checkIfTagIsValid(tag, previousTag) {
if (tag.existsInSchema || tag.takesValue) {
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 buildMappingObject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const buildMappingObject = function (entries) {
/**
* @type {Map<string, TagEntry>}
*/
const shortTagData = new Map()
- 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 constructor
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
constructor(name, booleanAttributes, valueAttributes, unitModifiers) {
super(name, booleanAttributes, valueAttributes)
this._derivativeUnits = [name]
if (!this.isSIUnit) {
- 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 populateTagDictionaries
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
populateTagDictionaries() {
this.tagAttributes = {}
for (const dictionaryKey of tagDictionaryKeys) {
const [tags, tagElements] = this.getTagsByAttribute(dictionaryKey)
if (dictionaryKey === extensionAllowedAttribute) {
- 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 parseProperties
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
parseProperties() {
const propertyDefinitions = this.getElementsByName('propertyDefinition')
this.properties = new Map()
for (const definition of propertyDefinitions) {
const propertyName = this.getElementTagName(definition)
- 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 splitLibraryAndVersion
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function splitLibraryAndVersion(schemaVersion, originalVersion) {
const versionSplit = schemaVersion.split('_')
let library = ''
let version
if (versionSplit.length > 2) {
- 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 this._spliceValueTemplate(columnTemplate)
Avoid too many return
statements within this function. Open
return replacementString.parseTree
Function initiallyValidateHedString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
const initiallyValidateHedString = function (hedString, hedSchemas, options, definitions = null) {
const doSemanticValidation = hedSchemas instanceof Schemas
if (!doSemanticValidation) {
hedSchemas = new Schemas(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 _convertTag
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_convertTag(hedString, hedSchemas, schemaName) {
const hed3ValidCharacters = /^[^{}[\]()~,\0\t]+$/
if (!hed3ValidCharacters.test(this.originalTag)) {
throw new Error('The parser failed to properly remove an illegal or special character.')
}
- 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 validateSidecarCurlyBraces
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
static validateSidecarCurlyBraces(sidecar) {
const issues = []
const references = sidecar.columnSpliceMapping
for (const [key, referredKeys] of references) {
- 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 validateHedDataset
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const validateHedDataset = function (hedStrings, hedSchemas, ...args) {
let settings
if (args[0] === Object(args[0])) {
settings = {
checkForWarnings: args[0].checkForWarnings ?? 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 checkIfTagIsValid
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
checkIfTagIsValid(tag, previousTag) {
if (tag.existsInSchema || tag.takesValue) {
return
}
// Whether this tag has an ancestor with the 'extensionAllowed' attribute.
- 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 checkTemporalSyntax
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
checkTemporalSyntax(tagGroup) {
if (!tagGroup.isTemporalGroup) {
return
}
const definitionName = this._getTemporalDefinitionName(tagGroup)
- 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 checkForInvalidTopLevelTagGroupTags
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
checkForInvalidTopLevelTagGroupTags() {
for (const tag of this.parsedString.tags) {
if (!tag.hasAttribute(topLevelTagGroupType) && !tag.parentHasAttribute(topLevelTagGroupType)) {
continue
}
- 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 validateHedDatasetWithContext
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const validateHedDatasetWithContext = function (hedStrings, contextHedStrings, hedSchemas, ...args) {
let settings
if (args[0] === Object(args[0])) {
settings = {
checkForWarnings: args[0].checkForWarnings ?? 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 isDescendantOf
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
isDescendantOf(parent) {
if (parent instanceof ParsedHedTag) {
if (this.schema !== parent.schema) {
return 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 generateMessage
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
generateMessage() {
// Convert all parameters except the substring bounds (an integer array) to their string forms.
this.parameters = mapValues(this.parameters, (value, key) => (key === 'bounds' ? value : String(value)))
const bounds = this.parameters.bounds ?? []
- 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 _parseHedColumn
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
_parseHedColumn() {
const hedColumn = this.parsedTsv.get('HED')
if (hedColumn === undefined) {
this.hedColumnHedStrings = []
} else {
- 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"