LearnersGuild/echo

View on GitHub

Showing 103 of 127 total issues

Function surveyBlueprintModel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export default function surveyBlueprintModel(thinky) {
  const {r, type: {string, date, array}} = thinky

  return {
    name: 'SurveyBlueprint',
Severity: Minor
Found in src/server/services/dataService/models/surveyBlueprint.js - About 1 hr 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 feedbackTypeModel has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export default function feedbackTypeModel(thinky) {
  const {r, type: {string, date}} = thinky

  return {
    name: 'FeedbackType',
Severity: Minor
Found in src/server/services/dataService/models/feedbackType.js - About 1 hr 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 12 (exceeds 5 allowed). Consider refactoring.
Open

function mapStateToProps(state) {
  const {
    surveys: {
      isBusy,
      isSubmitting,
Severity: Minor
Found in src/common/containers/RetroSurvey/index.jsx - About 1 hr 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 questionResponsesForFormFields has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

export function questionResponsesForFormFields(formFields, defaults) {
  try {
    if (!formFields) {
      return null
    }
Severity: Minor
Found in src/common/util/survey.js - About 1 hr to fix

    Function render has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      render() {
        const {isBusy, currentUser, projects} = this.props
    
        const projectData = projects.map(project => {
          const cycle = project.cycle || {}
    Severity: Minor
    Found in src/common/containers/ProjectList/index.jsx - About 1 hr to fix

      Function responseModel has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export default function responseModel(thinky) {
        const {r, type: {string, date, any}} = thinky
      
        return {
          name: 'Response',
      Severity: Minor
      Found in src/server/services/dataService/models/response.js - About 1 hr to fix

        Function routes has 34 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        const routes = store => {
          return (
            <Route path="/" component={userIsAuthenticated(App)}>
              <IndexRedirect to="/phases"/>
              <Route path="/chapters" component={Blank}>
        Severity: Minor
        Found in src/common/routes/index.jsx - About 1 hr to fix

          Function getProject has 34 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function getProject(identifier) {
            return {
              variables: {identifier},
              query: `
                query ($identifier: String!) {
          Severity: Minor
          Found in src/common/actions/queries/getProject.js - About 1 hr to fix

            Function getField has 34 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            function getField(type) {
              switch (type) {
                case 'TEXT':
                  return {
                    type: 'TEXT',
            Severity: Minor
            Found in src/common/components/__tests__/SurveyForm.test.js - About 1 hr to fix

              Function cycleModel has 33 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              export default function cycleModel(thinky) {
                const {r, type: {string, number, date}} = thinky
              
                return {
                  name: 'Cycle',
              Severity: Minor
              Found in src/server/services/dataService/models/cycle.js - About 1 hr to fix

                Function render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  render() {
                    const {users, activeUserIds} = this.props
                    const isReady = users && users.length > 0
                
                    if (!isReady) {
                Severity: Minor
                Found in src/common/components/UserGrid/index.jsx - About 1 hr to fix

                  Function render has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    render() {
                      const {
                        children,
                        active,
                        title,
                  Severity: Minor
                  Found in src/common/components/ConfirmationDialog/index.jsx - About 1 hr to fix

                    Function phaseModel has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function phaseModel(thinky) {
                      const {r, type: {string, date, number}} = thinky
                    
                      return {
                        name: 'Phase',
                    Severity: Minor
                    Found in src/server/services/dataService/models/phase.js - About 1 hr to fix

                      Function findUserProjectEvaluations has 32 lines of code (exceeds 25 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 1 hr to fix

                        Function chapterModel has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        export default function chapterModel(thinky) {
                          const {r, type: {string, number, date, array}} = thinky
                        
                          return {
                            name: 'Chapter',
                        Severity: Minor
                        Found in src/server/services/dataService/models/chapter.js - About 1 hr to fix

                          Function validateNumberGroup has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export function validateNumberGroup(values, options = {}) {
                            if (!values) {
                              if (options.required) {
                                return 'can\'t be blank'
                              }
                          Severity: Minor
                          Found in src/common/validations/index.js - About 1 hr 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 31 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            render() {
                              return (
                                <Flex flexDirection="column" className={styles.container}>
                                  <Flex>
                                    <Flex flexDirection="column" className={styles.sliderLeftCol}>
                          Severity: Minor
                          Found in src/common/components/SurveyFormInputSliderGroup/index.jsx - About 1 hr to fix

                            Function buildSurvey has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              buildSurvey() {
                                beforeEach(function () {
                                  this.buildSurvey = async function (surveyAttrs = {}) {
                                    const descriptor = surveyAttrs.descriptor || RETROSPECTIVE_DESCRIPTOR
                                    const cycleState = surveyAttrs.descriptor === WORK_PLAN_DESCRIPTOR ? GOAL_SELECTION : REFLECTION
                            Severity: Minor
                            Found in src/test/helpers/fixtures.js - About 1 hr to fix

                              Function chapters has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export default function chapters(state = initialState, action) {
                                switch (action.type) {
                                  case GET_CHAPTER_REQUEST:
                                  case FIND_CHAPTERS_REQUEST:
                                  case ADD_INVITE_CODE_TO_CHAPTER_REQUEST:
                              Severity: Minor
                              Found in src/common/reducers/chapters.js - About 1 hr to fix

                                Function render has 30 lines of code (exceeds 25 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 1 hr to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language