Showing 59 of 321 total issues
Function set
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
set(value) {
const attributeValue = getAttributeValues()
.filter((av) => av.attribute.name === attributeName)
.reduce((current, av) => av, undefined)
Function createPeriodGeneratorsForLocale
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function createPeriodGeneratorsForLocale(locale = 'en') {
return {
generateDailyPeriodsForYear: (year) =>
generateDailyPeriodsForYear(year, locale),
generateWeeklyPeriodsForYear: (year) =>
Function fromModel
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
fromModel(model, passFilterAsDimension = false) {
let request = this
// extract dimensions from model
const columns = model.columns || []
Function addDimension
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
addDimension(dimension, items) {
let dimensionIndex = 0
const existingDimension = this.dimensions.find((item, index) => {
if (item.dimension === dimension) {
Function addFilter
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
addFilter(dimension, items) {
let filterIndex = 0
const existingFilter = this.filters.find((item, index) => {
if (item.dimension === dimension) {
Function constructor
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
constructor(schema = {}, properties, validations, attributes, authorities) {
checkType(schema.singular, 'string')
checkType(schema.plural, 'string', 'Plural')
addLockedProperty(this, 'name', schema.singular)
Function getOptions
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
function getOptions(defaultHeaders, mergeOptions, requestData) {
const resultOptions = Object.assign(
{},
api.defaultFetchOptions,
mergeOptions
Function createModelPropertyDescriptor
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
function createModelPropertyDescriptor(propertiesObject, schemaProperty) {
const propertyName = schemaProperty.collection
? schemaProperty.collectionName
: schemaProperty.name
const propertyDetails = {
- 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 compareVersions
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static compareVersions(a, b) {
const from =
typeof a === 'string' || a instanceof String
? System.parseVersionString(a)
: a
- 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 processConfigForD2
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
static processConfigForD2(config, d2) {
const api = d2.Api.getApi()
d2.model.ModelDefinition.prototype.api = api
d2.models = d2.model.ModelDefinitions.getModelDefinitions()
- 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 buildUrl
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
buildUrl(options) {
// at least 1 dimension is required
let { dimensions } = this
if (options && options.sorted) {
- 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 makePeriodFixture
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function makePeriodFixture(id, name, startDate, endDate, type) {
Function buildQuery
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
buildQuery(options) {
let { filters } = this
if (options && options.sorted) {
filters = sortBy(filters, 'dimension')
- 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 set
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
set(key, value) {
const that = this
let req
if (key === 'systemId') {
- 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(fetchImpl) {
// Optionally provide fetch to the constructor so it can be mocked during testing
if (typeof fetchImpl === 'function') {
this.fetch = fetchImpl.bind(
typeof window !== 'undefined' ? window : global
- 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 update
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
update(url, data, useMergeStrategy = false, options = {}) {
let payload = data
// Ensure that headers are defined and are treated without case sensitivity
const requestOptions = {
- 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 post
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
post(url, data, options = {}) {
const requestUrl = getUrl(this.baseUrl, url)
let payload = data
// Ensure that headers are defined and are treated without case sensitivity
- 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 x
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export default (function x() {
const fixtures = {}
function getFixture(fixtureName) {
if (fixtures && fixtures[fixtureName]) {
- 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 createValidationSetting
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function createValidationSetting(validationObject, schemaProperty) {
const propertyName = schemaProperty.collection
? schemaProperty.collectionName
: schemaProperty.name
const validationDetails = {
- 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"