jbox-web/redmine_git_hosting

View on GitHub

Showing 67 of 67 total issues

Method commits_per_author_with_aliases has 32 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def commits_per_author_with_aliases
      return @commits_per_author_with_aliases if !@commits_per_author_with_aliases.nil?
      @commits_per_author_with_aliases = nil

      registered_committers = []
Severity: Minor
Found in app/reports/repository_contributors_stats.rb - About 1 hr to fix

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

          def validate_revision
            commit = nil
    
            # is the revision a branch?
            repository.branches.each do |x|
    Severity: Minor
    Found in app/use_cases/repositories/download_revision.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 29 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/xitolite_adapter.rb - About 1 hr to fix

      Method merge_permissions has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def merge_permissions(current_permissions, old_permissions)
              merge_permissions = {}
              merge_permissions['RW+'] = {}
              merge_permissions['RW'] = {}
              merge_permissions['R'] = {}
      Severity: Minor
      Found in app/services/permissions_builder/standard.rb - About 1 hr to fix

        Method sync_with_github has 28 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

              def sync_with_github
                create_relation = false
        
                ## We don't have stored relation
                if github_issue.nil?
        Severity: Minor
        Found in app/services/redmine_hooks/github_issues_sync.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/xitolite_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 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/xitolite_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 temp_dir_writeable? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def temp_dir_writeable?(opts = {})
                  @temp_dir_writeable = false if opts.has_key?(:reset) && opts[:reset] == true
          
                  if !@temp_dir_writeable
                    file_logger.debug("Testing if Gitolite Admin directory '#{create_temp_dir}' is writeable ...")
          Severity: Minor
          Found in lib/redmine_git_hosting/config/gitolite_config_tests.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 create_member has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def create_member(ids, current_ids, klass, opts = {}, &block)
                destroy      = opts.fetch(:destroy, true)
                inherited_by = opts.fetch(:inherited_by, nil)
          
                ids = (ids || []).collect(&:to_i) - [0]
          Severity: Minor
          Found in app/use_cases/repository_protected_branches/member_manager.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 authorized_request? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                  def authorized_request?
                    case git_cmd
                    when *RedmineGitHosting::GitAccess::DOWNLOAD_COMMANDS
                      if @user
                        RedmineGitHosting::GitAccess.new.download_access_check(@user, repository, is_ssl?).allowed?
          Severity: Minor
          Found in lib/redmine_git_hosting/patches/grack_auth_patch.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 check_xitolite_permissions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_xitolite_permissions
                case self.action_name
                when 'index', 'show'
                  perm = "view_#{self.controller_name}".to_sym
                  render_403 unless User.current.git_allowed_to?(perm, @repository)
          Severity: Minor
          Found in app/controllers/redmine_git_hosting_controller.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 get_cache has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def get_cache(repo_id, command)
                  cached = GitCache.find_by_repo_identifier_and_command(repo_id, command)
                  if cached
                    if valid_cache_entry?(cached.created_at)
                      # Update updated_at flag
          Severity: Minor
          Found in lib/redmine_git_hosting/cache/database.rb - 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

          Method mirror_configuration has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

              def mirror_configuration
                if mirror_mode?
                  reset_fields
                elsif include_all_branches? && include_all_tags?
                  mutual_exclusion_error
          Severity: Minor
          Found in app/models/repository_mirror.rb - 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

          Method sync_with_github has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
          Open

                def sync_with_github
                  create_relation = false
          
                  ## We don't have stored relation
                  if github_issue.nil?
          Severity: Minor
          Found in app/services/redmine_hooks/github_issues_sync.rb - 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

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

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

                  def auth!
                    if @auth.provided?
                      return bad_request unless @auth.basic?
          
                      # Authentication with username and password
          Severity: Minor
          Found in lib/redmine_git_hosting/patches/grack_auth_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 git_config has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

              def git_config
                repo_conf = {}
          
                # This is needed for all Redmine repositories
                repo_conf['redminegitolite.projectid']     = project.identifier.to_s
          Severity: Minor
          Found in app/models/concerns/gitolitable/config.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 destroy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

            def destroy
              if request.delete?
                if @gitolite_public_key.user == @user || @user.admin?
                  if @gitolite_public_key.destroy
                    destroy_ssh_key(@gitolite_public_key)
          Severity: Minor
          Found in app/controllers/gitolite_public_keys_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

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

                def do_call_webservice(payload)
                  post_failed, post_message = self.send(use_method, post_receive_url.url, { data: { payload: payload } })
          
                  if post_failed
                    logger.error('Failed!')
          Severity: Minor
          Found in app/services/redmine_hooks/call_webservices.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 additional_constraints_on_identifier has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                def additional_constraints_on_identifier
                  if !identifier.blank? && (new_record? || identifier_changed?)
                    errors.add(:identifier, :cannot_equal_project) if Project.find_by_identifier(identifier)
          
                    # See if a repo for another project has the same identifier (existing validations already check for current project)
          Severity: Minor
          Found in app/models/concerns/gitolitable/validations.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

          Severity
          Category
          Status
          Source
          Language