LearnersGuild/echo

View on GitHub

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">
Severity: Minor
Found in src/common/components/UserDetail/index.jsx - About 45 mins to fix

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,
Severity: Minor
Found in src/common/components/ProjectForm/index.jsx - About 45 mins to fix

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')
  }

Severity: Minor
Found in src/server/actions/importProject.js - About 45 mins to fix

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) {
Severity: Minor
Found in src/server/cliCommand/util.js - About 45 mins to fix

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) => {
Severity: Minor
Found in src/common/components/ProjectDetail/index.jsx - About 45 mins to fix

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
Severity: Minor
Found in src/server/cliCommand/util.js - About 45 mins to fix

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 || {}
Severity: Minor
Found in src/server/actions/updateUser.js - About 45 mins to fix

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) || {}
Severity: Minor
Found in src/common/containers/ProjectForm/index.jsx - About 45 mins to fix

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) {
Severity: Minor
Found in src/server/actions/saveChapter.js - About 35 mins to fix

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}`)
Severity: Minor
Found in src/script/importSurveyResponses.js - About 35 mins to fix

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 (
Severity: Minor
Found in src/common/components/SurveyForm/index.jsx - About 35 mins to fix

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) {
Severity: Minor
Found in src/common/components/Layout/Flex/index.jsx - About 35 mins to fix

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}`)
  }
Severity: Minor
Found in src/server/actions/findUserProjectEvaluations.js - About 35 mins to fix

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') ?
Severity: Minor
Found in src/common/containers/UserList/index.jsx - About 25 mins to fix

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)
Severity: Minor
Found in src/common/containers/ChapterForm/index.jsx - About 25 mins to fix

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
Severity: Minor
Found in src/server/cliCommand/util.js - About 25 mins to fix

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') {
Severity: Minor
Found in src/common/util/index.js - About 25 mins to fix

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
Severity: Minor
Found in src/common/util/index.js - About 25 mins to fix

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'
Severity: Minor
Found in src/test/config.js - About 25 mins to fix

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()
Severity: Minor
Found in src/common/components/SurveyFormInputSliderGroup/index.jsx - About 25 mins to fix

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

Severity
Category
Status
Source
Language