Codeminer42/cm42-central

View on GitHub

Showing 331 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

    Class has too many lines. [245/110]
    Open

    class Story < ApplicationRecord
      include ActiveModel::Transitions
      extend Enumerize
    
      before_validation :set_position_to_last
    Severity: Minor
    Found in app/models/story.rb by rubocop

    This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Class has too many lines. [210/110]
    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 by rubocop

    This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class NoteForm extends React.Component {
      constructor(props) {
        super(props);
        this.saveInputRef = input => {
          this.input = input;
    Severity: Major
    Found in app/assets/javascripts/components/notes/NoteForm.jsx and 1 other location - About 1 day to fix
    app/assets/javascripts/components/tasks/TaskForm.jsx on lines 4..47

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 307.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

    class TaskForm extends React.Component {
      constructor(props) {
        super(props);
        this.saveInputRef = input => {
          this.input = input;
    Severity: Major
    Found in app/assets/javascripts/components/tasks/TaskForm.jsx and 1 other location - About 1 day to fix
    app/assets/javascripts/components/notes/NoteForm.jsx on lines 4..47

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 307.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    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

      Class has too many lines. [121/110]
      Open

      class Project < ApplicationRecord
        attr_writer :suppress_notifications
      
        POINT_SCALES = {
          'fibonacci' => [1, 2, 3, 5, 8].freeze,
      Severity: Minor
      Found in app/models/project.rb by rubocop

      This cop checks if the length a class exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

      Complex method Project::has_many#from_csv (92.1)
      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 by flog

      Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

      You can read more about ABC metrics or the flog tool

      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

          Assignment Branch Condition size for from_csv is too high. [56.86/25]
          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 by rubocop

          This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              return this.model.save(null, {
                success: function (model, response) {
                  that.saveInProgress = false;
                  that.render();
                },
          Severity: Major
          Found in app/assets/javascripts/views/story_view.jsx and 1 other location - About 5 hrs to fix
          app/assets/javascripts/views/story_view.jsx on lines 226..240

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 143.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          Identical blocks of code found in 2 locations. Consider refactoring.
          Open

              return this.model.save(null, {
                success: function (model, response) {
                  that.saveInProgress = false;
                  that.render();
                },
          Severity: Major
          Found in app/assets/javascripts/views/story_view.jsx and 1 other location - About 5 hrs to fix
          app/assets/javascripts/views/story_view.jsx on lines 203..217

          Duplicated Code

          Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

          Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

          When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

          Tuning

          This issue has a mass of 143.

          We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

          The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

          If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

          See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

          Refactorings

          Further Reading

          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

            Complex method IterationService#group_by_day (67.0)
            Open

              def group_by_day(range = nil)
                @group_by_day = {}
                @group_by_day[range] ||= begin
                  accepted = @accepted_stories
                  accepted = accepted.select  { |story| story.accepted_at >= range.first && story.accepted_at < range.last } if range
            Severity: Minor
            Found in app/services/iteration_service.rb by flog

            Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

            You can read more about ABC metrics or the flog tool

            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

              Assignment Branch Condition size for group_by_day is too high. [44.88/25]
              Open

                def group_by_day(range = nil)
                  @group_by_day = {}
                  @group_by_day[range] ||= begin
                    accepted = @accepted_stories
                    accepted = accepted.select  { |story| story.accepted_at >= range.first && story.accepted_at < range.last } if range
              Severity: Minor
              Found in app/services/iteration_service.rb by rubocop

              This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

              Complex method ActivityPresenter#noun (61.7)
              Open

                def noun
                  case subject_type
                  when 'Project'
                    "#{subject_type} '#{helpers.link_to subject.name, project_path(subject)}'"
                  when 'Story'
              Severity: Minor
              Found in app/presenters/activity_presenter.rb by flog

              Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

              You can read more about ABC metrics or the flog tool

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              const normalizePastIterations = pastIterations => {
                return pastIterations.reduce(
                  (acc, pastIteration) => {
                    const pastIterationId = pastIteration.iterationNumber;
              
              
              Severity: Major
              Found in app/assets/javascripts/reducers/pastIterations.js and 1 other location - About 3 hrs to fix
              app/assets/javascripts/reducers/stories.js on lines 400..417

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 107.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              const normalizeStories = stories => {
                return stories.reduce(
                  (acc, story) => {
                    const storyId = story.id;
              
              
              Severity: Major
              Found in app/assets/javascripts/reducers/stories.js and 1 other location - About 3 hrs to fix
              app/assets/javascripts/reducers/pastIterations.js on lines 84..101

              Duplicated Code

              Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

              Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

              When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

              Tuning

              This issue has a mass of 107.

              We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

              The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

              If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

              See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

              Refactorings

              Further Reading

              Severity
              Category
              Status
              Source
              Language