jbox-web/redmine_git_hosting

View on GitHub

Showing 61 of 72 total issues

Method revisions has a Cognitive Complexity of 70 (exceeds 5 allowed). Consider refactoring.
Open

        def revisions(path, identifier_from, identifier_to, options = {}) # rubocop:disable Style/OptionHash
          revs = Revisions.new
          cmd_args = %w[log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller --parents --stdin]
          cmd_args << '--no-renames' if self.class.client_version_above? [2, 9]
          cmd_args << '--reverse' if options[:reverse]
Severity: Minor
Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 1 day 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

File xitolite_adapter.rb has 440 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require 'redmine/scm/adapters/abstract_adapter'

# XitoliteAdapter inherits from GitAdapter but some classes which are define directly in GitAdapter are not inherited
# (GitBranch, ScmCommandAborted and maybe others) so it raises NameError exception.
# To fix this I had to reimplement (copy/past) the whole GitAdapter class in XitoliteAdapter...
Severity: Minor
Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 6 hrs to fix

    Method entries has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring.
    Open

            def entries(path = nil, identifier = nil, **options)
              path ||= ''
              p = scm_iconv @path_encoding, 'UTF-8', path
              entries = Entries.new
              cmd_args = %w[ls-tree -l]
    Severity: Minor
    Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 6 hrs 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

    Class XitoliteAdapter has 35 methods (exceeds 20 allowed). Consider refactoring.
    Open

          class XitoliteAdapter < AbstractAdapter
            # Git executable name
            XITOLITE_BIN = Redmine::Configuration['scm_git_command'] || 'git'
            GIT_DEFAULT_BRANCH_NAMES = %w[main master].freeze
    
    
    Severity: Minor
    Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 4 hrs to fix

      Method revisions has 97 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def revisions(path, identifier_from, identifier_to, options = {}) # rubocop:disable Style/OptionHash
                revs = Revisions.new
                cmd_args = %w[log --no-color --encoding=UTF-8 --raw --date=iso --pretty=fuller --parents --stdin]
                cmd_args << '--no-renames' if self.class.client_version_above? [2, 9]
                cmd_args << '--reverse' if options[:reverse]
      Severity: Major
      Found in lib/redmine/scm/adapters/xitolite_adapter.rb - About 3 hrs to fix

        Method diff_with_options has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

              def diff_with_options
                if params[:format] == 'diff'
                  @diff = @repository.diff @path, @rev, @rev_to, bypass_cache: true
                  return show_error_not_found unless @diff
        
        
        Severity: Minor
        Found in lib/redmine_git_hosting/patches/repositories_controller_patch.rb - About 3 hrs 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 merge_permissions has a Cognitive Complexity of 20 (exceeds 5 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 2 hrs 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_permissions has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
        Open

            def extract_permissions(current_permissions)
              old_permissions = {}
        
              current_permissions.each do |perm, branch_settings|
                old_permissions[perm] = {}
        Severity: Minor
        Found in app/models/concerns/gitolitable/permissions.rb - About 2 hrs 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

        Class ShellRedirector has 21 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class ShellRedirector
            # Redirector states
            WAIT_TO_CHECK = 0
            RUNNING_SHELL = 1
            STRING_IO     = 2
        Severity: Minor
        Found in lib/redmine_git_hosting/shell_redirector.rb - About 2 hrs to fix

          Method find_project_repository has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
          Open

                def find_project_repository
                  @project = Project.find params[:id]
                  @repository = if params[:repository_id].present?
                                  @project.repositories.find_by_identifier_param params[:repository_id] # rubocop: disable Rails/DynamicFindBy
                                else
          Severity: Minor
          Found in lib/redmine_git_hosting/patches/repositories_controller_patch.rb - About 2 hrs 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 find_by_path has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
          Open

                  def find_by_path(path, flags = {})
                    parseit = path.match %r{\A.*?(([^/]+)/)?([^/]+?)(\.git)?\z}
                    return if parseit.nil?
          
                    project = Project.find_by identifier: parseit[3]
          Severity: Minor
          Found in app/models/concerns/gitolitable/cache.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_ref_spec has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def check_ref_spec
                refspec_parse = RedmineGitHosting::Validators.valid_git_refspec? mirror.explicit_refspec
                payloads.each do |payload|
                  next unless (splitpath = RedmineGitHosting::Utils::Git.parse_refspec payload[:ref])
          
          
          Severity: Minor
          Found in app/services/redmine_hooks/update_mirrors.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 refspec has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

            def refspec(mirror, max_refspec = 0)
              if mirror.mirror_mode?
                l :all_references
              else
                result = []
          Severity: Minor
          Found in app/helpers/repository_mirrors_helper.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

          Function createAreaChart has 42 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          function createAreaChart(element){
            $(element.target).highcharts({
              chart: {
                type: 'areaspline'
              },
          Severity: Minor
          Found in assets/javascripts/set_highcharts.js - About 1 hr to fix

            Method gitolite_plugin_settings_tabs has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def gitolite_plugin_settings_tabs
                [
                  { name: 'gitolite_config_ssh',
                    partial: 'settings/redmine_git_hosting/gitolite_config_ssh',
                    label: :label_tab_ssh },
            Severity: Minor
            Found in app/helpers/gitolite_plugin_settings_helper.rb - About 1 hr to fix

              Function createColumnChart has 38 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function createColumnChart(element){
                $(element.target).highcharts({
                  chart: {
                    type: 'column'
                  },
              Severity: Minor
              Found in assets/javascripts/set_highcharts.js - About 1 hr to fix

                Function createZoomableAreaChart has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function createZoomableAreaChart(element){
                  $(element.target).highcharts({
                    chart: {
                      type: "areaspline",
                      zoomType: "x"
                Severity: Minor
                Found in assets/javascripts/set_highcharts.js - About 1 hr to fix

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

                          def lastrev(path, rev)
                            return if path.nil?
                  
                            cmd_args = %w[log --no-color --encoding=UTF-8 --date=iso --pretty=fuller --no-merges -n 1]
                            cmd_args << '--no-renames' if self.class.client_version_above? [2, 9]
                  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 commits_per_author_with_aliases has 33 lines of code (exceeds 25 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 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

                    Severity
                    Category
                    Status
                    Source
                    Language