Codeminer42/cm42-central

View on GitHub

Showing 66 of 343 total issues

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

const filterAndRemoveStories = (mergedStories, fetchedStories) => {
  const serverBasedIds = Object.values(mergedStories.stories.byId)
    .filter(story => story.serverBased)
    .map(story => story.id);

Severity: Minor
Found in app/assets/javascripts/reducers/stories.js - About 1 hr to fix

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

      panelBody() {
        const { project, joined } = this.props;
    
        if (joined) {
          return (
    Severity: Minor
    Found in app/assets/javascripts/components/projects/ProjectCard.jsx - About 1 hr to fix

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

      const storiesReducer = (state = initialState, action) => {
        const denormalizedStories = denormalizeStories(state[action.from]);
      
        switch (action.type) {
          case actionTypes.RECEIVE_STORIES: {
      Severity: Minor
      Found in app/assets/javascripts/reducers/stories.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 newStory has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

        newStory: function () {
          if ($(window).width() <= 992) {
            _.each(this.columns, function (column, columnId) {
              if (columnId !== 'chilly_bin') if (!column.hidden()) column.toggle();
            });
      Severity: Minor
      Found in app/assets/javascripts/views/project_view.jsx - About 45 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 velocity has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          velocity: function (userVelocity) {
            if (!_.isUndefined(userVelocity)) {
              if (userVelocity < 1) {
                userVelocity = 1;
              }
      Severity: Minor
      Found in app/assets/javascripts/models/project.js - About 45 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

      Method fetch_polymorphic has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.fetch_polymorphic(ids, since)
          stories = where("subject_type in ('Project', 'Story')")
            .includes(:user, :subject)
            .projects(ids)
            .since(since).to_a
      Severity: Minor
      Found in app/models/activity.rb - About 35 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 scrollToStory has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        scrollToStory: function (story_hash) {
          if (story_hash.lastIndexOf('#story', 0) === 0) {
            var story = $(story_hash);
            if (story.length > 0) {
              story.click();
      Severity: Minor
      Found in app/assets/javascripts/views/project_view.jsx - About 35 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

      Method set_started_at has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def set_started_at
          return unless state_changed?
          return unless state == 'started'
          self.started_at = Time.current if started_at.nil?
          self.owned_by = acting_user if owned_by.nil? && acting_user
      Severity: Minor
      Found in app/models/story.rb - About 35 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

      Method resolve has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def resolve
            if root?
              User
            elsif admin?
              if current_project
      Severity: Minor
      Found in app/policies/user_policy.rb - About 35 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

      Avoid too many return statements within this function.
      Open

            return {
              ...state,
              [action.from]: normalizeStories(
                replaceOrAddNewStory(denormalizedStories, clonedStory)
              ),
      Severity: Major
      Found in app/assets/javascripts/reducers/stories.js - About 30 mins to fix

        Avoid too many return statements within this function.
        Open

                return {
                  ...state,
                  [action.from]: normalizeStories(
                    withoutNewStory(denormalizedStories, action.id)
                  ),
        Severity: Major
        Found in app/assets/javascripts/reducers/stories.js - About 30 mins to fix

          Avoid too many return statements within this function.
          Open

              return true;
          Severity: Major
          Found in app/assets/javascripts/views/story_view.jsx - About 30 mins to fix

            Avoid too many return statements within this function.
            Open

                  return {
                    ...state,
                    [action.from]: normalizeStories(
                      denormalizedStories.map(updateIfSameId(action.id, toggleStory))
                    ),
            Severity: Major
            Found in app/assets/javascripts/reducers/stories.js - About 30 mins to fix

              Avoid too many return statements within this function.
              Open

                  if ($(e.target).parent().is('button')) return false;
              Severity: Major
              Found in app/assets/javascripts/views/story_view.jsx - About 30 mins to fix

                Avoid too many return statements within this function.
                Open

                    return dragDropStory(dragStory.id, dragStory.projectId, {
                      position,
                      newPosition,
                      state: newState,
                    });
                Severity: Major
                Found in app/assets/javascripts/components/projects/ProjectBoard.jsx - About 30 mins to fix

                  Function renderNotes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    renderNotes: function () {
                      const $storyNotes = this.$('[data-story-notes]');
                      if ($storyNotes.length && !this.model.isNew()) {
                        const isReadonly = this.isReadonly();
                        const notes = this.model.notes;
                  Severity: Minor
                  Found in app/assets/javascripts/views/story_view.jsx - About 25 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 ExpandedStoryControls has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const ExpandedStoryControls = ({
                    onSave,
                    onCancel,
                    onDelete,
                    canSave,

                  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

                  Method column has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    def column
                      case state
                      when 'unscheduled'
                        '#chilly_bin'
                      when 'unstarted'
                  Severity: Minor
                  Found in app/models/story.rb - About 25 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 mergeWithFetchedStories has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                  const mergeWithFetchedStories = (currentStories, fetchedStories) => {
                    if (Object.values(currentStories).length === 0) {
                      const firstStoriesById = fetchedStories.stories.allIds.reduce(
                        (acc, storyId) => {
                          return {
                  Severity: Minor
                  Found in app/assets/javascripts/reducers/stories.js - About 25 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 renderSelects has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                  Open

                    renderSelects: function () {
                      const $storyEstimateSelect = this.$('[data-story-estimate]');
                      if ($storyEstimateSelect.length) {
                        const storyEstimateOptions = this.model
                          .point_values()
                  Severity: Minor
                  Found in app/assets/javascripts/views/story_view.jsx - About 25 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