Showing 127 of 127 total issues
Function renderSidebar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
renderSidebar() {
const {user, currentUser, defaultAvatarURL, onClickEdit} = this.props
const emailLink = user.email ? (
<a href={`mailto:${user.email}`} target="_blank" rel="noopener noreferrer">
- 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 render
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {
pristine,
handleSubmit,
submitting,
- 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 _validateMembers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function _validateMembers(userIdentifiers = []) {
if (!Array.isArray(userIdentifiers) || userIdentifiers.length === 0) {
throw new LGBadRequestError('Must specify at least one project member')
}
- 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 _indexOfWordEnd
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function _indexOfWordEnd(chars, pos, len, opts) {
const options = Object.assign({escape: '\\'}, opts)
const ESCAPE = options.escape.charCodeAt(0)
let escaping = false
for (let i = pos; i <= len; ++i) {
- 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 renderDetails
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
renderDetails() {
const {project = {}, projectUserSummaries} = this.props
const {chapter, cycle, phase} = project
const memberList = projectUserSummaries.map((projectUserSummary, index) => {
- 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 _indexOfQuotedStringEnd
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function _indexOfQuotedStringEnd(chars, pos, len, opts) {
const options = Object.assign({escape: '\\', quote: '"'}, opts)
const ESCAPE = options.escape.charCodeAt(0)
const QUOTE = options.quote.charCodeAt(0)
let escaping = 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 updateUser
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default async function updateUser(userId, values) {
const {Member, Phase} = require('src/server/services/dataService')
const {updateUser: idmUpdateUser} = require('src/server/services/idmService')
const {phaseNumber, roles} = values || {}
- 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 mapStateToProps
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function mapStateToProps(state, props) {
const {identifier} = props.params
const {app, projects} = state
const project = findAny(projects.projects, identifier, ['id', 'name'])
const chapter = (project ? project.chapter : 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 saveChapter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default async function saveChapter(values = {}) {
const chapter = {...values}
let chapterWithSameName
if (chapter.name) {
- 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 validateResponseItem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function validateResponseItem(data) {
const {surveyId, questionId, respondentId, subjectId, value} = data || {}
if (typeof surveyId !== 'string' || surveyId.length === 0) {
throw new Error(`Invalid surveyId: ${surveyId}`)
- 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 renderFieldInput
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
renderFieldInput(field) {
const {input: {onChange: handleChange}} = field
switch (field.type) {
case FORM_INPUT_TYPES.TEXT:
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 render
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
const classNames = Object.keys(this.props)
.reduce((result, propName) => {
const propValue = this.props[propName]
if (propValue) {
- 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 findUserProjectEvaluations
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default async function findUserProjectEvaluations(userIdentifier, projectIdentifier) {
const user = await (typeof userIdentifier === 'string' ? Member.get(userIdentifier) : userIdentifier)
if (!user || !user.id) {
throw new LGBadRequestError(`User not found for identifier: ${userIdentifier}`)
}
- 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 render
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
render() {
const {users, isBusy, currentUser} = this.props
const userData = users.map(user => {
const userURL = userCan(currentUser, 'viewUser') ?
- 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 mapStateToProps
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
function mapStateToProps(state, props) {
const {identifier} = props.params
const {isBusy, chapters} = state.chapters
const chapter = chapters[identifier] || Object.values(chapters).find(c => c.name === identifier)
- 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 _tokenizeCommandString
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function _tokenizeCommandString(commandStr) {
const argv = []
for (let i = 0, endPos = 0; i < commandStr.length; ++i) {
if (commandStr.charCodeAt(i) === SPACE) {
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 toSortedArray
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export function toSortedArray(obj, attr, options = {}) {
if (!obj) {
return
}
if (typeof attr !== 'string') {
- 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 factorial
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
export const factorial = (function () {
const f = []
return function factorial(n) {
if (n === 0 || n === 1) {
return 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 testContext
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
global.testContext = function (filename) {
return filename.slice(1).split('/').reduce(function (ret, curr) {
const currWithoutTests = curr === '__tests__' ? null : String('/' + curr)
const value = ret.useCurr && currWithoutTests ? String(ret.value + currWithoutTests) : ret.value
const useCurr = ret.useCurr || curr === 'echo'
- 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 handleUpdate
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
handleUpdate(key, newValue) {
if (this.props.onChange) {
newValue = newValue || 0
const oldValue = this.getValue(key)
const oldSum = this.getSum()
- 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"