jbox-web/redmine_git_hosting

View on GitHub

Showing 67 of 67 total issues

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

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

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

        def create_member(ids, current_ids, klass, opts = {}, &block)
    Severity: Minor
    Found in app/use_cases/repository_protected_branches/member_manager.rb - About 35 mins to fix

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

            def execute_update_mirrors_hook
              message = 'Notifying mirrors about changes to this repository :'
              y = ''
      
              ## Post to each post-receive URL
      Severity: Minor
      Found in app/use_cases/repositories/execute_hooks.rb and 1 other location - About 35 mins to fix
      app/use_cases/repositories/execute_hooks.rb on lines 61..75

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

      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

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

        def get_hour_from_date(date)
          return nil unless date
          time = date.to_time
          zone = User.current.time_zone
          local = zone ? time.in_time_zone(zone) : (time.utc? ? time.localtime : time)
      Severity: Minor
      Found in app/reports/report_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 check_repo_hierarchy has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def check_repo_hierarchy
              ## Storage infos has changed, move repositories!
              if value_has_changed?(:gitolite_global_storage_dir)  ||
                 value_has_changed?(:gitolite_redmine_storage_dir) ||
                 value_has_changed?(:hierarchical_organisation)
      Severity: Minor
      Found in app/use_cases/settings/apply.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 commits_per_author_with_aliases has a Cognitive Complexity of 7 (exceeds 5 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 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

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

            def execute_call_webservices_hook
              message = 'Notifying post receive urls about changes to this repository :'
              y = ''
      
              ## Post to each post-receive URL
      Severity: Minor
      Found in app/use_cases/repositories/execute_hooks.rb and 1 other location - About 35 mins to fix
      app/use_cases/repositories/execute_hooks.rb on lines 43..57

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

      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

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

            def parse_refspec(spec)
              parsed_refspec = spec.match(REF_COMPONENT_REGEX)
              return nil if parsed_refspec.nil?
              if parsed_refspec[1]
                # Should be first class.  If no type component, return fail
      Severity: Minor
      Found in lib/redmine_git_hosting/utils/git.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 move_physical_repo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

                def move_physical_repo(old_path, new_path, new_parent_path)
                  ## CASE 0
                  if old_path == new_path
                    logger.info("#{context} : old repository and new repository are identical '#{old_path}', nothing to do, exit !")
                    return true

      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 default_repository_has_identifier has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def default_repository_has_identifier
              if project && (is_default? || set_as_default?)
                possibles = Repository.where("project_id = ? and (identifier = '' or identifier is null)", project.id)
                errors.add(:base, :blank_default_exists) if possibles.any? && (new_record? || possibles.detect { |x| x.id != id })
              end
      Severity: Minor
      Found in app/models/concerns/gitolitable/validations.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 true

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

                current_permissions.each do |perm, branch_settings|
                  branch_settings.each do |branch, user_list|
                    if user_list.any?
                      if !merge_permissions[perm].has_key?(branch)
                        merge_permissions[perm][branch] = []
        Severity: Minor
        Found in app/services/permissions_builder/standard.rb and 1 other location - About 30 mins to fix
        app/services/permissions_builder/standard.rb on lines 52..59

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

        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

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

                      revision = Revision.new({
                        :identifier => changeset[:commit],
                        :scmid      => changeset[:commit],
                        :author     => changeset[:author],
                        :time       => Time.parse(changeset[:date]),
        Severity: Minor
        Found in lib/redmine/scm/adapters/xitolite_adapter.rb and 1 other location - About 30 mins to fix
        lib/redmine/scm/adapters/xitolite_adapter.rb on lines 245..252

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

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

                old_permissions.each do |perm, branch_settings|
                  branch_settings.each do |branch, user_list|
                    if user_list.any?
                      if !merge_permissions[perm].has_key?(branch)
                        merge_permissions[perm][branch] = []
        Severity: Minor
        Found in app/services/permissions_builder/standard.rb and 1 other location - About 30 mins to fix
        app/services/permissions_builder/standard.rb on lines 41..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 32.

        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

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

                          revision = Revision.new({
                            :identifier => changeset[:commit],
                            :scmid      => changeset[:commit],
                            :author     => changeset[:author],
                            :time       => Time.parse(changeset[:date]),
        Severity: Minor
        Found in lib/redmine/scm/adapters/xitolite_adapter.rb and 1 other location - About 30 mins to fix
        lib/redmine/scm/adapters/xitolite_adapter.rb on lines 299..306

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

        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

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

                def git_config_as_hash(namespace, params)
                  value_hash = {}
        
                  params.each do |value_pair|
                    next if value_pair.empty?
        Severity: Minor
        Found in lib/redmine_git_hosting/commands/git.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 install! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def install!
              if !file_exists?
                logger.info("Hook '#{name}' does not exist, installing it ...")
                install_hook
              elsif hook_file_has_changed?
        Severity: Minor
        Found in lib/redmine_git_hosting/gitolite_hook.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 resync_gitolite has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def resync_gitolite(command, object, options = {})
                if options.has_key?(:bypass_sidekiq) && options[:bypass_sidekiq] == true
                  bypass = true
                else
                  bypass = false
        Severity: Minor
        Found in lib/redmine_git_hosting/gitolite_accessor.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 key_uniqueness has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def key_uniqueness
              return if !new_record?
              existing = GitolitePublicKey.find_by_fingerprint(fingerprint)
              if existing
                if existing.user == User.current
        Severity: Minor
        Found in app/models/gitolite_public_key.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 entry has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def entry(path = nil, identifier = nil)
                  parts = path.to_s.split(%r{[\/\\]}).select { |n| !n.blank? }
                  search_path = parts[0..-2].join('/')
                  search_name = parts[-1]
                  if search_path.blank? && search_name.blank?
        Severity: Minor
        Found in lib/redmine/scm/adapters/xitolite_adapter.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