Codeminer42/cm42-central

View on GitHub

Showing 66 of 343 total issues

File story_view.jsx has 1020 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import React from 'react';
import ReactDOM from 'react-dom';
import StoryControls from 'components/story/StoryControls';
import StoryDescription from 'components/story/StoryDescription';
import StoryHistoryLocation from 'components/story/StoryHistoryLocation';
Severity: Major
Found in app/assets/javascripts/views/story_view.jsx - About 2 days to fix

    StoryView has 73 functions (exceeds 20 allowed). Consider refactoring.
    Open

    const StoryView = FormView.extend({
      template: storyTemplate,
      alert: alertTemplate,
    
      tagName: 'div',
    Severity: Major
    Found in app/assets/javascripts/views/story_view.jsx - About 1 day to fix

      File stories.js has 412 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      import actionTypes from 'actions/actionTypes';
      import {
        toggleStory,
        editStory,
        addNewAttributes,
      Severity: Minor
      Found in app/assets/javascripts/reducers/stories.js - About 5 hrs to fix

        File story.js has 395 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import { status, storyTypes, storyScopes } from 'libs/beta/constants';
        import httpService from '../../services/httpService';
        import changeCase from 'change-object-case';
        import * as Label from './label';
        import PropTypes from 'prop-types';
        Severity: Minor
        Found in app/assets/javascripts/models/beta/story.js - About 5 hrs to fix

          Function renderSelects has 107 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            renderSelects: function () {
              const $storyEstimateSelect = this.$('[data-story-estimate]');
              if ($storyEstimateSelect.length) {
                const storyEstimateOptions = this.model
                  .point_values()
          Severity: Major
          Found in app/assets/javascripts/views/story_view.jsx - About 4 hrs to fix

            File story.js has 329 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import actionTypes from './actionTypes';
            import {
              sendSuccessNotification,
              sendErrorNotification,
              sendDefaultErrorNotification,
            Severity: Minor
            Found in app/assets/javascripts/actions/story.js - About 3 hrs to fix

              Function panelHeading has 81 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                panelHeading() {
                  const { project, joined } = this.props;
              
                  if (joined) {
                    return (
              Severity: Major
              Found in app/assets/javascripts/components/projects/ProjectCard.jsx - About 3 hrs to fix

                Method from_csv_row has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
                Open

                    def from_csv_row(row)
                      # Ensure no email notifications get sent during CSV import
                      project = proxy_association.owner.project
                      project.suppress_notifications
                
                
                Severity: Minor
                Found in app/models/story.rb - 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

                Class Story has 25 methods (exceeds 20 allowed). Consider refactoring.
                Open

                class Story < ApplicationRecord
                  include ActiveModel::Transitions
                  extend Enumerize
                
                  before_validation :set_position_to_last
                Severity: Minor
                Found in app/models/story.rb - About 2 hrs to fix

                  Method from_csv has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
                  Open

                      def from_csv(csv_string)
                        # Eager load this so that we don't have to make multiple db calls when
                        # searching for users by full name from the CSV.
                        users = proxy_association.owner.users
                  
                  
                  Severity: Minor
                  Found in app/models/project.rb - 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

                  Class ProjectsController has 24 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class ProjectsController < ApplicationController
                    before_action :set_project, only: %i[show edit update destroy import import_upload
                                                         reports ownership archive unarchive
                                                         change_archived projects_unjoined]
                    before_action :prepare_session, only: %i[import import_upload]
                  Severity: Minor
                  Found in app/controllers/projects_controller.rb - About 2 hrs to fix

                    File story.js has 272 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import ActivityCollection from '../collections/activity_collection';
                    import NoteCollection from '../collections/note_collection';
                    import TaskCollection from '../collections/task_collection';
                    import SharedModelMethods from '../mixins/shared_model_methods';
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/models/story.js - About 2 hrs to fix

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

                      const projectBoardReducer = (state = initialState, action) => {
                        switch (action.type) {
                          case actionTypes.REQUEST_PROJECT_BOARD:
                            return {
                              ...state,
                      Severity: Major
                      Found in app/assets/javascripts/reducers/projectBoard.js - About 2 hrs to fix

                        Class IterationService has 22 methods (exceeds 20 allowed). Consider refactoring.
                        Open

                        class IterationService
                          DAYS_IN_WEEK = (1.week / 1.day)
                          VELOCITY_ITERATIONS = 3
                          STD_DEV_ITERATIONS = 10
                          DEFAULT_VELOCITY = 10
                        Severity: Minor
                        Found in app/services/iteration_service.rb - About 2 hrs to fix

                          Function ProjectBoard has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
                          Open

                          export const ProjectBoard = ({
                            fetchProjectBoard,
                            projectId,
                            projectBoard,
                            closeHistory,
                          Severity: Minor
                          Found in app/assets/javascripts/components/projects/ProjectBoard.jsx - 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

                          File project.js has 258 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          import Cookies from 'js-cookie';
                          import StoryCollection from '../collections/story_collection';
                          import UserCollection from '../collections/user_collection';
                          import Iteration from '../models/iteration';
                          import ProjectBoard from '../models/projectBoard';
                          Severity: Minor
                          Found in app/assets/javascripts/models/project.js - About 2 hrs to fix

                            Function mergeWithFetchedStories has 53 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const mergeWithFetchedStories = (currentStories, fetchedStories) => {
                              if (Object.values(currentStories).length === 0) {
                                const firstStoriesById = fetchedStories.stories.allIds.reduce(
                                  (acc, storyId) => {
                                    return {
                            Severity: Major
                            Found in app/assets/javascripts/reducers/stories.js - About 2 hrs to fix

                              File ProjectBoard.jsx has 255 lines of code (exceeds 250 allowed). Consider refactoring.
                              Open

                              import React, { useEffect, useState } from 'react';
                              import { connect } from 'react-redux';
                              import {
                                fetchProjectBoard,
                                toggleColumn,
                              Severity: Minor
                              Found in app/assets/javascripts/components/projects/ProjectBoard.jsx - About 2 hrs to fix

                                Method change_archived has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
                                Open

                                  def change_archived(archive = true)
                                    @project = policy_scope(Project).archived.friendly.find(params[:id]) unless @project
                                    authorize @project
                                
                                    result = ProjectOperations::Update.call(
                                Severity: Minor
                                Found in app/controllers/projects_controller.rb - 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

                                File iteration.js has 253 lines of code (exceeds 250 allowed). Consider refactoring.
                                Open

                                import moment from 'moment';
                                import { last, isEmpty } from 'underscore';
                                import * as Story from './story';
                                
                                const weeksBetween = (dateA, dateB) =>
                                Severity: Minor
                                Found in app/assets/javascripts/models/beta/iteration.js - About 2 hrs to fix
                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language