casefoundation/weekly-roundup

View on GitHub

Showing 49 of 49 total issues

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

  render() {
    let content;
    let buttons;
    let modal;
    if (this.props.Roundup.roundup && this.props.Roundup.roundup.result) {
Severity: Major
Found in client/src/containers/Roundups/View.js - About 6 hrs to fix

    Function default has 117 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    export default function (state = defaultState, action) {
      switch (action.type) {
        // ROUNDUP ACTIONS
    
        case RoundupActionType.ROUNDUP_LOADING:
    Severity: Major
    Found in client/src/reducers/RoundupReducer.js - About 4 hrs to fix

      File View.js has 353 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import React, { Component } from 'react';
      import { connect } from 'react-redux';
      import { withRouter } from 'react-router';
      import dotprop from 'dot-prop-immutable';
      import { TransitionGroup } from 'react-transition-group';
      Severity: Minor
      Found in client/src/containers/Roundups/View.js - About 4 hrs to fix

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

          render() {
            // Users Pagination module
            const pagination = (
              <Pagination
                activePage={this.props.Users.page}
        Severity: Major
        Found in client/src/containers/Users/View.js - About 3 hrs to fix

          Function init has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
          Open

          exports.init = () =>
            knex.schema.hasTable('user').then((exists) => {
              if (!exists) {
                return createUserTable(knex);
              }
          Severity: Minor
          Found in server/lib/database.js - About 2 hrs 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 66 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            render() {
              let content;
              let buttons;
          
              if (this.props.Roundup.isSending) {
          Severity: Major
          Found in client/src/containers/Roundups/Preview.js - About 2 hrs to fix

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

              render() {
                const buttons = (
                  <div>
                    <MenuButton name="close" text="Cancel" onClick={this.onCancel} />
                    <MenuButton name="check" className="px-3" text="Save" onClick={this.onSave} />
            Severity: Major
            Found in client/src/containers/Settings/View.js - About 2 hrs to fix

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

                render() {
                  let pagination;
                  if (this.props.Archive.totalCount) {
                    pagination = (
                      <Pagination
              Severity: Major
              Found in client/src/containers/Roundups/Archive.js - About 2 hrs to fix

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

                  render() {
                    const article = this.props.article;
                
                    return (
                      <SectionEditable
                Severity: Major
                Found in client/src/components/Article/ArticleSection.js - About 2 hrs to fix

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

                    render() {
                      let content;
                      if (this.props.Auth.isPasswordReset) {
                        // Step 3: Show success and direct user to Login
                        content = (
                  Severity: Major
                  Found in client/src/containers/Auth/ResetPassword.js - About 2 hrs to fix

                    Function Update has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      Update: function (id, title, source, published, summary, url, article_group_id, group_order_shift) {
                        return bookshelf.transaction(transacting => {
                          return Article.ById(id, transacting)
                            .then((article) => {
                              const oldOrder = article.get('group_order');
                    Severity: Major
                    Found in server/lib/models/Article.js - About 2 hrs to fix

                      Function default has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                      export default function (state = defaultState, action) {
                        switch (action.type) {
                          case AuthActionType.LOGGING_IN:
                            return combine(defaultState, {
                              isLoading: true,
                      Severity: Major
                      Found in client/src/reducers/AuthReducer.js - About 2 hrs to fix

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

                          render() {
                            if (this.props.isLoading) {
                              return <LoadingSpinner />;
                            }
                        
                        
                        Severity: Major
                        Found in client/src/components/Layout/Dashboard.js - About 2 hrs to fix

                          Function articleCreate has 49 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                          export function articleCreate(article_group_id, urls = [], group_order_start = 0) {
                            // Validate urls
                            let validationError;
                            if (urls.length === 0) {
                              validationError = 'Please provide at least one url to analyze.';
                          Severity: Minor
                          Found in client/src/actions/Article/ArticleActions.js - About 1 hr to fix

                            Function saveUser has 48 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const saveUser = (req, res) => {
                              const saveUserHelper = (user) => {
                                if (req.body.password && req.body.password.trim().length > 0) {
                                  user.setPassword(req.body.password);
                                }
                            Severity: Minor
                            Found in server/lib/routes/user.js - About 1 hr to fix

                              Function formatData has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
                              Open

                              const formatData = (metadata) => {
                                const analyzedData = {
                                  title: '',
                                  source: '',
                                  published: '',
                              Severity: Minor
                              Found in server/lib/scraper.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 47 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                render() {
                                  const linksMarkup = [];
                                  for (let i = 0; i < this.state.links.length; i++) {
                                    const link = this.state.links[i];
                                    linksMarkup.push(
                              Severity: Minor
                              Found in client/src/components/Article/NewArticleSection.js - About 1 hr to fix

                                Function formatRoundup has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                exports.formatRoundup = function (baseUrl, roundup, signature) {
                                  let content = '';
                                  if (roundup && roundup.articleGroups) {
                                    roundup.articleGroups.forEach(ag => {
                                      // Only show article groups with articles
                                Severity: Minor
                                Found in server/lib/roundupMailFormatter.js - About 1 hr to fix

                                  Function default has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  export default function (state = defaultState, action) {
                                    switch (action.type) {
                                      case UsersActionType.USERS_LOADING:
                                        return combine(defaultState, {
                                          isLoading: true,
                                  Severity: Minor
                                  Found in client/src/reducers/UsersReducer.js - About 1 hr to fix

                                    Function UpdateDiffRecipients has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      UpdateDiffRecipients: function (transacting, roundup, to = [], cc = []) {
                                        const promises = [];
                                        const toHash = {};
                                        const ccHash = {};
                                        const roundupToHash = {};
                                    Severity: Minor
                                    Found in server/lib/models/Roundup.js - About 1 hr to fix
                                      Severity
                                      Category
                                      Status
                                      Source
                                      Language