jbox-web/redmine_git_hosting

View on GitHub

Showing 79 of 79 total issues

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

    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

      Method refspec has a Cognitive Complexity of 12 (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

      Method entries has 34 lines of code (exceeds 25 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 1 hr to fix

        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

          Function applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            , applyPlacement: function(offset, placement){
                var $tip = this.tip()
                  , width = $tip[0].offsetWidth
                  , height = $tip[0].offsetHeight
                  , actualWidth
          Severity: Minor
          Found in assets/javascripts/bootstrap/bootstrap_tooltip.js - About 1 hr to fix

            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 diff_with_options has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def diff_with_options
                      if params[:format] == 'diff'
                        @diff = @repository.diff(@path, @rev, @rev_to, bypass_cache: true)
                        (show_error_not_found; return) unless @diff
                        filename = "changeset_r#{@rev}"
              Severity: Minor
              Found in lib/redmine_git_hosting/patches/repositories_controller_patch.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

                  Function openModalBox has 28 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                  function openModalBox(element, type) {
                    var buttons = {};
                  
                    if (type == 'modal-box') {
                      var label_save   = $('#modal-box').data('label-save');
                  Severity: Minor
                  Found in assets/javascripts/bootstrap/bootstrap_modal.js - 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 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 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 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 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 check_xitolite_permissions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def check_xitolite_permissions
                          case action_name
                          when 'index', 'show'
                            perm = "view_#{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

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

                            this.timeout = setTimeout(function() {
                              if (self.hoverState == 'in') self.show()
                            }, self.options.delay.show)
                      Severity: Major
                      Found in assets/javascripts/bootstrap/bootstrap_tooltip.js and 1 other location - About 1 hr to fix
                      assets/javascripts/bootstrap/bootstrap_tooltip.js on lines 109..111

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

                      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

                            this.timeout = setTimeout(function() {
                              if (self.hoverState == 'out') self.hide()
                            }, self.options.delay.hide)
                      Severity: Major
                      Found in assets/javascripts/bootstrap/bootstrap_tooltip.js and 1 other location - About 1 hr to fix
                      assets/javascripts/bootstrap/bootstrap_tooltip.js on lines 97..99

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

                      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