Codeminer42/cm42-central

View on GitHub

Showing 331 of 343 total issues

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

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

              return (
                <a
                  href={project.get('path_to').project}
                  className="card-footer panel-footer"
                >
        Severity: Minor
        Found in app/assets/javascripts/components/projects/ProjectCard.jsx and 1 other location - About 30 mins to fix
        app/assets/javascripts/components/projects/ProjectCard.jsx on lines 189..196

        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 50.

        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 3 locations. Consider refactoring.
        Open

                <li>
                  <span>
                    <b>title:</b> {I18n.t('activerecord.models.story.one')}
                  </span>
                </li>
        Severity: Minor
        Found in app/assets/javascripts/components/search/SearchTooltip.jsx and 2 other locations - About 30 mins to fix
        app/assets/javascripts/components/search/SearchTooltip.jsx on lines 44..48
        app/assets/javascripts/components/search/SearchTooltip.jsx on lines 78..82

        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 50.

        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

        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

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

                return (
                  <a
                    href={project.get('path_to').projectJoin}
                    className="card-footer panel-footer"
                  >
            Severity: Minor
            Found in app/assets/javascripts/components/projects/ProjectCard.jsx and 1 other location - About 30 mins to fix
            app/assets/javascripts/components/projects/ProjectCard.jsx on lines 179..186

            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 50.

            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 3 locations. Consider refactoring.
            Open

                    <li>
                      <span>
                        <b>state:</b> {I18n.t('story.state.unscheduled')}
                      </span>
                    </li>
            Severity: Minor
            Found in app/assets/javascripts/components/search/SearchTooltip.jsx and 2 other locations - About 30 mins to fix
            app/assets/javascripts/components/search/SearchTooltip.jsx on lines 29..33
            app/assets/javascripts/components/search/SearchTooltip.jsx on lines 44..48

            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 50.

            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 3 locations. Consider refactoring.
            Open

                    <li>
                      <span>
                        <b>type:</b> {I18n.t('story.type.feature')}
                      </span>
                    </li>
            Severity: Minor
            Found in app/assets/javascripts/components/search/SearchTooltip.jsx and 2 other locations - About 30 mins to fix
            app/assets/javascripts/components/search/SearchTooltip.jsx on lines 29..33
            app/assets/javascripts/components/search/SearchTooltip.jsx on lines 78..82

            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 50.

            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

            Complex method ConfirmationsController#show (21.5)
            Open

              def show
                self.resource = resource_class.confirm_by_token(params[:confirmation_token])
            
                if resource.valid? && resource.errors.empty?
                  set_flash_message :notice, :confirmed

            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

            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

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

                startDate: function () {
                  var start_date;
                  if (this.get('start_date')) {
                    // Parse the date string into an array of [YYYY, MM, DD] to
                    // ensure identical date behaviour across browsers.
            Severity: Minor
            Found in app/assets/javascripts/models/project.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

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

                def resolve
                  if root?
                    Project.all
                  elsif admin?
                    current_team.projects
            Severity: Minor
            Found in app/policies/project_policy.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

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

              def call
                project.stories
                       .where(requested_by_id: user.id)
                       .or(project.stories.where(owned_by_id: user.id))
                       .where.not(state: "accepted").each do |story|
            Severity: Minor
            Found in app/services/remove_stories_from_user_service.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

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

              def set_accepted_at
                return unless state_changed?
                return unless state == 'accepted'
                self.accepted_at = Time.current if accepted_at.nil?
                self.cycle_time = accepted_at - started_at if started_at
            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

            Severity
            Category
            Status
            Source
            Language