LearnersGuild/echo

View on GitHub

Showing 127 of 127 total issues

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

  render() {
    const {projectData, projectModel, allowImport, onClickImport} = this.props
    const header = (
      <ContentHeader
        title="Projects"
Severity: Minor
Found in src/common/components/ProjectList/index.jsx - 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

      Function surveyModel has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

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

        Function generateReport has 29 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        async function generateReport(user) {
          const projects = await findUserProjects(user.id)
        
          return Promise.reduce(projects, async (result, project) => {
            const {cycle} = project
        Severity: Minor
        Found in src/server/reports/memberRetroFeedback.js - About 1 hr to fix

          Function projects has 29 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export default function projects(state = initialState, action) {
            switch (action.type) {
              case FIND_PROJECTS_REQUEST:
              case GET_PROJECT_REQUEST:
              case DELETE_PROJECT_REQUEST:
          Severity: Minor
          Found in src/common/reducers/projects.js - About 1 hr to fix

            Function projectSummaries has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

            export default function projectSummaries(state = initialState, action) {
              switch (action.type) {
                case GET_PROJECT_SUMMARY_REQUEST:
                  return Object.assign({}, state, {
                    isBusy: true,
            Severity: Minor
            Found in src/common/reducers/projectSummaries.js - About 1 hr to fix

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

                Function graphQLFetcher has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                export default function graphQLFetcher(baseURL, lgJWT = serverToServerJWT()) {
                  return graphQLParams => {
                    const options = {
                      method: 'post',
                      headers: {
                Severity: Minor
                Found in src/server/util/graphql.js - About 1 hr to fix

                  Function memberModel has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

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

                    Function initializeChannel has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export default async function initializeChannel(name, {topic, users}) {
                      const chatService = require('src/server/services/chatService')
                    
                      try {
                        await chatService.createChannel(name)
                    Severity: Minor
                    Found in src/server/actions/initializeChannel.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 resolveFindProjectsForCycle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                    Open

                    export async function resolveFindProjectsForCycle(source, args = {}, {currentUser}) {
                      if (!userCan(currentUser, 'findProjects')) {
                        throw new LGNotAuthorizedError()
                      }
                    
                    
                    Severity: Minor
                    Found in src/server/graphql/resolvers/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 app has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                    export default function app(state = initialState, action) {
                      switch (action.type) {
                        case APP_SHOW_LOADING:
                          return {...state, showLoading: true}
                    
                    
                    Severity: Minor
                    Found in src/common/reducers/app.js - About 1 hr to fix

                      Function findUsers has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

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

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

                              this.buildSurvey = async function (surveyAttrs = {}) {
                                const descriptor = surveyAttrs.descriptor || RETROSPECTIVE_DESCRIPTOR
                                const cycleState = surveyAttrs.descriptor === WORK_PLAN_DESCRIPTOR ? GOAL_SELECTION : REFLECTION
                                this.cycle = surveyAttrs.cycle || await factory.create('cycle', {state: cycleState})
                                this.cycleId = this.cycle.id
                        Severity: Minor
                        Found in src/test/helpers/fixtures.js - About 1 hr to fix

                          Function addInviteCodeToChapter has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function addInviteCodeToChapter(id, inviteCodeData) {
                            // because invite codes are stored in `idm` but chapter data lives in
                            // `echo`, we first need to create the invite code through `idm`, then
                            // associate it with the chapter in `echo`
                            return {
                          Severity: Minor
                          Found in src/common/actions/chapter.js - About 1 hr to fix

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

                              render() {
                                const {isBusy, chapters, currentUser} = this.props
                            
                                if (chapters.length === 0 && isBusy) {
                                  return null
                            Severity: Minor
                            Found in src/common/containers/ChapterList/index.jsx - About 1 hr to fix

                              Function define has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                              export default function define(factory) {
                                const commonAttrs = {
                                  id: cb => cb(null, faker.random.uuid()),
                                  name: factory.sequence(n => `funky-falcon-${n}`),
                                  chapterId: factory.assoc('chapter', 'id'),
                              Severity: Minor
                              Found in src/test/factories/project.js - About 1 hr to fix

                                Function formFieldsForQuestionGroup has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export function formFieldsForQuestionGroup(questionGroup) {
                                  try {
                                    if (!questionGroup) {
                                      return null
                                    }
                                Severity: Minor
                                Found in src/common/util/survey.js - About 55 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 findActiveProjectsForChapter has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                export default async function findActiveProjectsForChapter(chapterId, options = {}) {
                                  const latestCycle = await getLatestCycleForChapter(chapterId, {default: null})
                                  if (!latestCycle) {
                                    throw new LGInternalServerError(`Cycle not found for chapter ${chapterId}`)
                                  }
                                Severity: Minor
                                Found in src/server/actions/findActiveProjectsForChapter.js - About 55 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 _validateProject has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                Open

                                async function _validateProject(projectIdentifier, {chapter, cycle}) {
                                  let project
                                  if (projectIdentifier) {
                                    project = await getProject(projectIdentifier)
                                    if (project) {
                                Severity: Minor
                                Found in src/server/actions/importProject.js - About 55 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