rosa-abf/rosa-build

View on GitHub

Showing 209 of 209 total issues

Method build_all has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
Open

  def build_all
    return unless start
    # later with resque
    arches_list     = arch_names ? Arch.where(name: arch_names.split(', ')) : Arch.all
    projects_list.lines.each do |name|
Severity: Minor
Found in app/models/mass_build.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

File build_lists_helper.rb has 292 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module BuildListsHelper

  # See: app/assets/javascripts/angularjs/models/build_list.js.erb
  def build_list_status_color(status)
    case status
Severity: Minor
Found in app/helpers/build_lists_helper.rb - About 3 hrs to fix

    File project.rb has 285 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    class Project < ActiveRecord::Base
      has_ancestry orphan_strategy: :adopt # we replace a 'path' method in the Git module
    
      include Autostart
      include Owner
    Severity: Minor
    Found in app/models/project.rb - About 2 hrs to fix

      Class Project has 25 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Project < ActiveRecord::Base
        has_ancestry orphan_strategy: :adopt # we replace a 'path' method in the Git module
      
        include Autostart
        include Owner
      Severity: Minor
      Found in app/models/project.rb - About 2 hrs to fix

        Class ApplicationPolicy has 24 methods (exceeds 20 allowed). Consider refactoring.
        Open

        class ApplicationPolicy
          attr_reader :user, :record
        
          def initialize(user, record)
            # raise Pundit::NotAuthorizedError, 'must be logged in' unless user
        Severity: Minor
        Found in app/policies/application_policy.rb - About 2 hrs to fix

          Method update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              respond_to do |format|
                format.html { render nothing: true, status: 200 }
          
                format.json {
          Severity: Minor
          Found in app/controllers/projects/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 update has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            def update
              @pull = @project.pull_requests.includes(:issue).where(issues: {serial_id: params[:id]}).first
              authorize @pull
          
              if pull_params.present?
          Severity: Minor
          Found in app/controllers/api/v1/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 actual_inline_comment? has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
          Open

            def actual_inline_comment?(diff = nil, force = false)
              unless force
                raise "This is not inline comment!" if data.blank? # for debug
                return data[:actual] unless data[:actual].nil?
                return false if diff.nil?
          Severity: Minor
          Found in app/models/comment.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 parse_projects_platforms has a Cognitive Complexity of 19 (exceeds 5 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 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 has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

            def find
              build_lists =  @project ? @project.build_lists : BuildList.all
          
              if @options[:id]
                build_lists = build_lists.where(id: @options[:id])
          Severity: Minor
          Found in app/models/build_list/filter.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 autostart_build_lists has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
          Open

            def self.autostart_build_lists(autostart_status)
              Project.where(autostart_status: autostart_status).find_each do |p|
                p.project_to_repositories.autostart_enabled.includes(repository: :platform).each do |p_to_r|
                  repository  = p_to_r.repository
                  user        = User.find(p_to_r.user_id)
          Severity: Minor
          Found in app/models/project.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 59 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def create
                key = "#{save_to_repository_id}-#{build_for_platform_id}"
                projects_for_cleanup = $redis.with { |r| r.lrange(PROJECTS_FOR_CLEANUP, 0, -1) }.select do |k|
                  (testing && k =~ /^testing-[\d]+-#{key}$/) || (!testing && k =~ /^[\d]+-#{key}$/)
                end
          Severity: Major
          Found in app/services/abf_worker_service/rpm.rb - About 2 hrs to fix

            Class Collaborator has 22 methods (exceeds 20 allowed). Consider refactoring.
            Open

            class Collaborator
              include ActiveModel::Conversion
              include ActiveModel::Validations
              include ActiveModel::Serializers::JSON
              extend  ActiveModel::Naming
            Severity: Minor
            Found in app/models/collaborator.rb - About 2 hrs to fix

              Method create_notifications has 58 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def self.create_notifications(record)
              
                  case record.class.to_s
                  when 'GitHook'
                    return unless record.project
              Severity: Major
              Found in app/models/concerns/feed/git.rb - About 2 hrs to fix

                Method run_mass_import has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    def run_mass_import(url, srpms_list, visibility, owner, add_to_repository_id)
                      doc = Nokogiri::HTML(open(url))
                      links = doc.css("a[href$='.src.rpm']")
                      return if links.count == 0
                      filter = srpms_list.lines.map(&:chomp).map(&:strip).select(&:present?)
                Severity: Major
                Found in app/models/concerns/git.rb - About 2 hrs to fix

                  Method abf_worker_args has 57 lines of code (exceeds 25 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: Major
                  Found in app/models/build_list.rb - About 2 hrs to fix

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

                      def publish
                        @build_list.update_type = params[:build_list][:update_type] if params[:build_list][:update_type].present?
                    
                        if params[:attach_advisory].present? and params[:attach_advisory] != 'no' and !@build_list.advisory
                    
                    
                    Severity: Minor
                    Found in app/controllers/projects/build_lists_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

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

                    class Repository < ActiveRecord::Base
                      extend FriendlyId
                      friendly_id :name, use: [:finders]
                    
                      include EventLoggable
                    Severity: Minor
                    Found in app/models/repository.rb - About 2 hrs to fix

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

                      class PullRequest < ActiveRecord::Base
                        STATUSES = [
                          STATUS_OPEN     = 'open',
                          STATUS_READY    = 'ready',
                          STATUS_ALREADY  = 'already',
                      Severity: Minor
                      Found in app/models/pull_request.rb - About 2 hrs to fix
                        Severity
                        Category
                        Status
                        Source
                        Language