rosa-abf/rosa-build

View on GitHub

Showing 181 of 209 total issues

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

  def update_average_build_time
    if status_changed?
      self.started_at = Time.now if status == self.class::BUILD_STARTED
      if [self.class::BUILD_ERROR,
          self.class::SUCCESS,
Severity: Minor
Found in app/models/concerns/build_list_observer.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 abf_worker_args has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def abf_worker_args
    repos = include_repos
    include_repos_hash = {}.tap do |h|
      Repository.where(id: (repos | (extra_repositories || [])) ).each do |repo|
        path, prefix = repo.platform.public_downloads_url(
Severity: Minor
Found in app/models/build_list.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 create has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def create
    unless pull_params
      redirect :back
    end
    to_project = find_destination_project
Severity: Minor
Found in app/controllers/projects/pull_requests_controller.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 render_issues_list has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

  def render_issues_list
    @issues = @issues.preload(:user, :assignee, :labels, :project).without_pull_requests
    if params[:status] == 'closed'
      @issues = @issues.closed
    else
Severity: Minor
Found in app/controllers/api/v1/issues_controller.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 read_and_write has 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def read_and_write(input, stdin, stdout, stderr, timeout=nil, max=nil)
        max = nil if max && max <= 0
        @out, @err = '', ''
        offset = 0

Severity: Major
Found in lib/ext/posix_spawn.rb - About 2 hrs to fix

    File diff_helper.rb has 253 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    module DiffHelper
      include CommitHelper
    
      MAX_LINES_WITHOUT_COLLAPSE = 50
    
    
    Severity: Minor
    Found in app/helpers/diff_helper.rb - About 2 hrs to fix

      Method shift has 51 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        def shift
          $redis.with do |r|
            job_shift_sem = Redis::Semaphore.new(:job_shift_lock, redis: r)
            job_shift_sem.lock do
              shifted_build_lists = r.smembers('abf_worker:shifted_build_lists')
      Severity: Major
      Found in app/controllers/api/v1/jobs_controller.rb - About 2 hrs to fix

        Method new_comment_notifications has 51 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def new_comment_notifications
            return if automatic?
        
            if issue_comment?
              commentable.subscribes.each do |subscribe|
        Severity: Major
        Found in app/models/concerns/feed/comment.rb - About 2 hrs to fix

          Method perform has 50 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def perform
                return if subject.valid? && restart_task
                if options['feedback_from_user']
                  user = User.find options['feedback_from_user']
                  return if !user.system? && subject.builder != user
          Severity: Minor
          Found in app/jobs/abf_worker/rpm_worker_observer.rb - About 2 hrs to fix

            Method render_pulls_list has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def render_pulls_list
                @pulls = @pulls.includes(issue: [:user, :assignee])
                if params[:status] == 'closed'
                  @pulls = @pulls.closed_or_merged
                else
            Severity: Minor
            Found in app/controllers/api/v1/pull_requests_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 show has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def show
                unless request.xhr?
                  render('empty') and return if @project.is_empty?
                  @tree = @tree / @path if @path.present?
                  @commit = @branch.present? ? @branch.commit() : @project.repo.log(@treeish, @path, max_count: 1).first
            Severity: Minor
            Found in app/controllers/projects/git/trees_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 default_encoding! has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
            Open

              def default_encoding!
                default_encoding = Encoding.default_internal || Encoding::UTF_8
                if ascii_only? # no need to encode if ascii
                  force_encoding(default_encoding)
                else # should encode
            Severity: Minor
            Found in lib/ext/core/string.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 init_variables has 46 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def init_variables
                case params[:range]
                when RANGE_TWENTY_FOUR_HOURS
                  @range_end    = Time.now.utc
                  @range_start  = @range_end - 1.day
            Severity: Minor
            Found in app/controllers/statistics_controller.rb - About 1 hr to fix

              Method index has 46 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def index
                  params[:kind]      = params[:kind] == 'pull_requests' ? 'pull_requests' : 'issues'
                  raise Pundit::NotAuthorizedError if !@project.has_issues? && params[:kind] == 'issues'
              
                  params[:filter]    = params[:filter].in?(['created', 'assigned']) ? params[:filter] : 'all'
              Severity: Minor
              Found in app/controllers/projects/issues_controller.rb - About 1 hr to fix

                Function Typeahead has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    var Typeahead = function(element, options) {
                        
                    //deal with scrollBar
                    var defaultOptions=$.fn.typeahead.defaults;
                    if(options.scrollBar){
                Severity: Minor
                Found in app/assets/javascripts/lib/bootstrap-typeahead.js - About 1 hr to fix

                  Method perform has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def self.perform(build_list_id, user_id, project_ids, arch_ids, options)
                        build_list  = BuildList.find(build_list_id)
                        return if build_list.save_to_platform.personal?
                        user        = User.find(user_id)
                  
                  
                  Severity: Minor
                  Found in app/jobs/build_lists/dependent_packages_job.rb - About 1 hr to fix

                    Method show_fail_reason has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def show_fail_reason
                        respond_to do |format|
                          format.html {
                            @build_lists = @mass_build.build_lists.where(status: BuildList::BUILD_ERROR).page(params[:page])
                            data = @build_lists.pluck(:id, :project_id, :arch_id, :fail_reason)
                    Severity: Minor
                    Found in app/controllers/platforms/mass_builds_controller.rb - About 1 hr to fix

                      Method build_list has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
                      Open

                        def build_list
                          return @build_list if !!@build_list
                          return nil if @path !~ /\/(release|updates)+\/[\w\-\.\+]+$/
                          return nil unless repository_name = @path.match(/\/[\w]+\/(release|updates)\//)
                          repository_name = repository_name[0].gsub(/\/(release|updates)\/$/, '').gsub('/', '')
                      Severity: Minor
                      Found in app/models/platform_content.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 perform has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def perform
                            return if status == STARTED # do nothing when publication started
                            extra = options['extra']
                            repository_status = RepositoryStatus.where(id: extra['repository_status_id']).first
                            begin
                      Severity: Minor
                      Found in app/jobs/abf_worker/publish_observer.rb - About 1 hr to fix

                        Method parse_projects_platforms has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def self.parse_projects_platforms(advisory, pr)
                            pr ||= {}
                            if !pr.is_a?(Hash)
                              advisory.errors.add(:base, "Projects is not a hash")
                              return {}
                        Severity: Minor
                        Found in app/services/advisory_service/create.rb - About 1 hr to fix
                          Severity
                          Category
                          Status
                          Source
                          Language