haru/redmine_code_review

View on GitHub

Showing 30 of 30 total issues

Method sort has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def sort
    setting = CodeReviewProjectSetting.find_or_create(@project)
    @auto_assign = setting.auto_assign_settings
    filters = params[:auto_assign][:filters].values unless params[:auto_assign][:filters].blank?
    filters = [] unless filters
Severity: Minor
Found in app/controllers/code_review_settings_controller.rb - 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 setAddReviewButton has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

function setAddReviewButton(url, change_id, image_tag, is_readonly, is_diff, attachment_id) {
Severity: Minor
Found in assets/javascripts/code_review.js - About 45 mins to fix

    Method view_issues_show_details_bottom_org has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

      def view_issues_show_details_bottom_org(context = {})
        project = context[:project]
        return '' unless project
        unless User.current.allowed_to?({:controller => 'code_review', :action => 'show'}, project)
          return ''
    Severity: Minor
    Found in lib/code_review_issue_hooks.rb - 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 edit_filter has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def edit_filter
        setting = CodeReviewProjectSetting.find_or_create(@project)
        @auto_assign = setting.auto_assign_settings
        num = params[:num].to_i
        filters = params[:auto_assign][:filters].values unless params[:auto_assign][:filters].blank?
    Severity: Minor
    Found in app/controllers/code_review_settings_controller.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 select_assign_to_with_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def select_assign_to_with_list(project, list, commiter_id = nil)
          return nil unless list
          return nil if list.empty?
          list.collect! { |item| item.to_i }
          list.delete(commiter_id)
    Severity: Minor
    Found in lib/code_review_auto_assign_settings.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 create_with_changeset has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def self.create_with_changeset(changeset)
        project = changeset.project
        setting = CodeReviewProjectSetting.find_or_create(project)
        auto_assign = setting.auto_assign_settings
        assignment = CodeReviewAssignment.new
    Severity: Minor
    Found in app/models/code_review_assignment.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 method.
    Open

        return unless auto_assign.match_with_change?(self)
    Severity: Major
    Found in lib/code_review_change_patch.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

            return ex.to_s
      Severity: Major
      Found in app/models/code_review.rb - About 30 mins to fix

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

        function getReviewObjById(review_id) {
          for (var reviewlist in code_reviews_map) {
            for (var i = 0; i < reviewlist.length; i++) {
              var review = reviewlist[i];
              if (review.id == review_id) {
        Severity: Minor
        Found in assets/javascripts/code_review.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 open_assignment_issues has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def open_assignment_issues(user_id)
            issues = []
            assignments = []
            assignments = change.code_review_assignments if change
            assignments = assignments + changeset.code_review_assignments if changeset
        Severity: Minor
        Found in app/models/code_review.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