Showing 24 of 77 total issues
Function createValueStoreDataType
has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring. Open
export function createValueStoreDataType<T>(parse: (inputString: string, format?: string) => T, format: (val: T, format?: string) => string) {
return class BaseValueDataType implements ComparableValueDataType {
value: T|null;
static fromData(value: string, field?: SchemaField, Class?: new () => BaseValueDataType) {
- 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 matchesFilter
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
let matchesFilter = (filter) => (value) => {
return Object.keys(filter).every((key) => {
if (!isKnown(filter[key])) return true;
if (filter[key] === value[key]) return true;
if (typeof value[key] === 'object') return matchesFilter(filter[key])(value[key]);
- 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 createValueStoreDataType
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createValueStoreDataType<T>(parse: (inputString: string, format?: string) => T, format: (val: T, format?: string) => string) {
return class BaseValueDataType implements ComparableValueDataType {
value: T|null;
static fromData(value: string, field?: SchemaField, Class?: new () => BaseValueDataType) {
Function dataTypeForType
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
export function dataTypeForType(type: SchemaType) {
if (type.category === SchemaTypeCategory.Numeric) {
let numericParams = type.parameters as NumericTypeInfo;
if (numericParams.isInteger) return Integer;
if (numericParams.isFloating) return Float;
- 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 addDefaultValidations
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function addDefaultValidations(field: SchemaFieldInfo): SchemaValidation[] {
return [
...field.validations,
...addValidation(hasValue(field.min))({
name: 'min',
Function render
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
render() {
let hardCodedUnit = this.type().unitSource.unit;
let unitCategory = this.type().unitSource.unitCategory;
let units = this.type().unitSource.units;
let hasUnits = !!unitCategory;
- 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 validateOnTimeMatch
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function validateOnTimeMatch(validation: SchemaValidation, time: ValidationTime, validate: Validation, value, field: SchemaField, params): ValidationResults {
Function addUnitData
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async addUnitData(field: SchemaField) {
if (field.type.category !== SchemaTypeCategory.Quantity) return Promise.resolve();
let type = field.type as QuantityType;
let unitSpec = type.parameters.unitSource;
- 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 createMetatonicAppInitializer
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function createMetatonicAppInitializer(config: MetatonicAppConfig){
let o = config;
let hasDefaultContext = o.dataStore && o.componentRegistry;
let getAllKeys = (...maps: any[]) => new Set(maps.filter(_=>_).reduce((keys, map) => [...keys, Object.keys(map)], new Array<string>()));
let allKeys = getAllKeys(o.dataStores, o.contexts, o.componentRegistries, hasDefaultContext ? { default: {} } : {});
- 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 getField
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
let getField = function (fieldTypeName: string, propertyKey: string, label: string, editSelect: SchemaEntryType, isMulti: boolean, options?: OptionalProps<SchemaField>) {
Function required
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export const required: Validation = function required(value, field, validation, time, params) {
Function regexValidaiton
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export const regexValidaiton: Validation<any> = function regex(value, field, validation, time, params) {
Function maxLength
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export const maxLength: Validation = function maxLength(value, field, validation, time, params) {
Function min
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export const min: Validation = function min(value, field, validation, time, params) {
Function max
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export const max: Validation = function max(value, field, validation, time, params) {
Function getDefaultFormState
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function getDefaultFormState(type: SchemaType, value?) {
const addChildFieldStateForField:FieldStateAdder = (children, field) => Object.assign(children, {
[field.name]: field.multiple && value && value[field.name] && Array.isArray(value[field.name]) ?
{
validationMessages:[],
- 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 compare
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function compare(left: DecimalData, right: DecimalData): number|null {
if (left === null || right === null) return null;
if (left.leftInt === right.leftInt) {
if (left.rightZeros === right.rightZeros) {
return left.rightInt - right.rightInt;
- 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 encode
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export function encode(obj, prefix?) {
let str = new Array<any>(), prop;
for (prop in obj) {
if (obj.hasOwnProperty(prop)) {
let key = getQueryStringKeyForObjectProp(prefix, prop);
- 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 getEditorComponents
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
getEditorComponents(field: SchemaField): LabeledEditor<TEditor, TLabeler, TRepeater>|null {
if (!field.name && !field.entryType)
return this.edit.getEditorParts(field.typeName, field.uiControlPreference);
if (field.entryType === SchemaEntryType.entry) {
- 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
if (dateTimeParams.type === DateTimeTypes.DateTime) return TimeStamp;