jbox-web/redmine_git_hosting

View on GitHub

Showing 72 of 72 total issues

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

    def extract_payloads
      new_payloads = []
      payloads.each do |payload|
        data = RedmineGitHosting::Utils::Git.parse_refspec payload[:ref]
        next unless data[:type] == 'heads' && post_receive_url.triggers.include?(data[:name])
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 commits_per_author_with_aliases has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def commits_per_author_with_aliases
    return @commits_per_author_with_aliases unless @commits_per_author_with_aliases.nil?

    @commits_per_author_with_aliases = nil

Severity: Minor
Found in app/reports/repository_contributors_stats.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 valid_name? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

        def valid_name?(name)
          return false unless name.is_a? String

          return false if name.start_with? '-', '/', 'refs/heads/', 'refs/remotes/'
          return false if name == 'HEAD'
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 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 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

    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 33..47

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

    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

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

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

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

      def destroy
        return unless request.delete?
    
        if @gitolite_public_key.user == @user || @user.admin?
          if @gitolite_public_key.destroy
    Severity: Minor
    Found in app/controllers/gitolite_public_keys_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 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 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 build_new_credential has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def build_new_credential
        credential = @repository.deployment_credentials.new
        credential.safe_attributes = params[:repository_deployment_credential]
        key = GitolitePublicKey.find_by id: params[:repository_deployment_credential][:gitolite_public_key_id]
    
    
    Severity: Minor
    Found in app/controllers/repository_deployment_credentials_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 git_config_as_hash has a Cognitive Complexity of 7 (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 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 get_hour_from_date has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

      def get_hour_from_date(date)
        return unless date
    
        time = date.to_time
        zone = User.current.time_zone
    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 default_repository_has_identifier has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
    Open

        def default_repository_has_identifier
          return unless project && (is_default? || set_as_default?)
    
          possibles = Repository.where project_id: project.id
          possibles = possibles.where(identifier: nil).or(possibles.where(identifier: ''))
    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

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

      def key_uniqueness
        return unless new_record?
    
        existing = GitolitePublicKey.find_by fingerprint: fingerprint
        return unless existing
    Severity: Minor
    Found in app/models/gitolite_public_key.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

          old_permissions.each do |perm, branch_settings|
            branch_settings.each do |branch, user_list|
              next unless user_list.any?
    
              merge_permissions[perm][branch] = [] unless merge_permissions[perm].key? 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 37..43

    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]),
                                                message: changeset[:description],
    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 272..278

    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]),
                                            message: changeset[:description],
    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 223..229

    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

          current_permissions.each do |perm, branch_settings|
            branch_settings.each do |branch, user_list|
              next unless user_list.any?
    
              merge_permissions[perm][branch] = [] unless merge_permissions[perm].key? 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 46..52

    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

    Severity
    Category
    Status
    Source
    Language