Restream/redmine_undev_git

View on GitHub

Showing 48 of 48 total issues

Method initial_parse_comments has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def initial_parse_comments(changeset)
    ref_keywords = Setting.commit_ref_keywords
    all_hooks    = all_applicable_hooks
    fix_keywords = all_hooks.map(&:keywords).join(',')

Severity: Minor
Found in lib/redmine_undev_git/includes/repo_fetch.rb - About 1 hr 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 apply_hooks_for_branch has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

  def apply_hooks_for_branch(changeset, branch)
    ref_keywords = Setting.commit_ref_keywords
    all_hooks    = all_applicable_hooks
    fix_keywords = all_hooks.map(&:keywords).join(',')

Severity: Minor
Found in lib/redmine_undev_git/includes/repo_hooks.rb - About 1 hr 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 hook_custom_field_value_tag has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def hook_custom_field_value_tag(name, custom_value)
    custom_field = custom_value.custom_field
    field_name   = "#{name}[custom_field_values][#{custom_field.id}]"
    field_name << '[]' if custom_field.multiple?
    field_id = "#{name}_custom_field_values_#{custom_field.id}"
Severity: Minor
Found in app/helpers/hooks_helper.rb - About 1 hr to fix

    Method apply_hooks_to_issue_by_repo_revision has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def apply_hooks_to_issue_by_repo_revision(issue_id, action, repo_revision)
    
          issue = Issue.find_by_id(issue_id)
    
          unless Policies::ApplyHooks.allowed?(repo_revision.committer, issue)
    Severity: Minor
    Found in lib/redmine_undev_git/services/remote_repo_fetch.rb - About 1 hr to fix

      Method lastrev has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def lastrev(path, rev)
            return nil if path.nil?
            cmd_args = %w{log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1}
            cmd_args << rev if rev
            cmd_args << '--' << path unless path.empty?
      Severity: Minor
      Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 1 hr 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 shell_out has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def shell_out(cmd, &block)
            exit_status = nil
            errors = nil
            Open3.popen3(cmd) do |stdin, stdout, stderr, wait_thr|
              stdin.set_encoding('ASCII-8BIT') if stdin.respond_to?(:set_encoding)
      Severity: Minor
      Found in lib/redmine_undev_git/includes/git_shell.rb - About 1 hr 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 annotate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def annotate(path, identifier = nil)
            identifier = 'HEAD' if identifier.blank?
            cmd_args   = %w{blame --encoding=UTF-8}
            cmd_args << '-p' << identifier << '--' << scm_iconv(path_encoding, 'UTF-8', path)
            blame   = Annotate.new
      Severity: Minor
      Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 1 hr 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_changesets has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

        def fetch_changesets
          fetch_start = Time.now
          init_scm
          scm.fetch!
      
      
      Severity: Minor
      Found in lib/redmine_undev_git/includes/repo_fetch.rb - About 1 hr 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 annotate has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def annotate(path, identifier = nil)
            identifier = 'HEAD' if identifier.blank?
            cmd_args   = %w{blame --encoding=UTF-8}
            cmd_args << '-p' << identifier << '--' << scm_iconv(path_encoding, 'UTF-8', path)
            blame   = Annotate.new
      Severity: Minor
      Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 1 hr to fix

        Method parse_comment_for_issues has 26 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def parse_comment_for_issues(ref_keywords, fix_keywords)
                ret = { ref_issues: [], fix_issues: {}, log_time: {} }
        
                return ret if comments.blank?
        
        
        Severity: Minor
        Found in lib/redmine_undev_git/patches/changeset_patch.rb - About 1 hr to fix

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

              def diff(path, identifier_from, identifier_to = nil)
                path     ||= ''
                cmd_args = []
                if identifier_to
                  cmd_args << 'diff' << '--no-color' << identifier_to << identifier_from
          Severity: Minor
          Found in lib/redmine/scm/adapters/undev_git_adapter.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 show has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def show
                  begin
                    @repository.fetch_changesets if Setting.autofetch_changesets? && @path.empty?
                  rescue
                  end
          Severity: Minor
          Found in lib/redmine_undev_git/patches/repositories_controller_patch.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 initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def initialize(url, root_url, login=nil, password=nil, path_encoding=nil)
          Severity: Minor
          Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 35 mins to fix

            Method revisions has 5 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def revisions(path, identifier_from, identifier_to, options = {}, &block)
            Severity: Minor
            Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 35 mins to fix

              Method revisions_in_chunks has 5 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def revisions_in_chunks(path, identifier_from, identifier_to, options = {}, &block)
              Severity: Minor
              Found in lib/redmine/scm/adapters/undev_git_adapter.rb - About 35 mins to fix

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

                        def fetch_changesets
                          Project.active.has_module(:repository).each do |project|
                            project.repositories.each do |repository|
                              begin
                                if self.fetch_by_web_hook?(repository)
                Severity: Minor
                Found in lib/redmine_undev_git/patches/repository_patch.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 handle_push_event has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def handle_push_event
                      return unless push_event?
                      repos = find_repositories
                      if repos.any?
                        fetch_repositories(repos)
                Severity: Minor
                Found in lib/redmine_undev_git/services/remote_repo_service.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 link_revision_to_issue has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                    def link_revision_to_issue(revision, issue_id)
                      return unless issue_id
                
                      user = user_by_email(revision.cemail) || User.anonymous
                
                
                Severity: Minor
                Found in lib/redmine_undev_git/services/remote_repo_fetch.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 hook_custom_field_value_tag has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                  def hook_custom_field_value_tag(name, custom_value)
                    custom_field = custom_value.custom_field
                    field_name   = "#{name}[custom_field_values][#{custom_field.id}]"
                    field_name << '[]' if custom_field.multiple?
                    field_id = "#{name}_custom_field_values_#{custom_field.id}"
                Severity: Minor
                Found in app/helpers/hooks_helper.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_mappings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
                Open

                      def create_mappings
                        new_urls = []
                        Repository::Git.order(:id).map do |r|
                          old_repo = Repo.new(
                            id:         r.id,
                Severity: Minor
                Found in lib/redmine_undev_git/services/migration.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

                Severity
                Category
                Status
                Source
                Language