Showing 80 of 167 total issues

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

    def github_action(client, &block)
      if client.kind_of?(Octokit::Client)
        # Inject Faraday::Request::Retry to the client if necessary
        client = inject_retry_middleware(client)
        # `rate_limit_retry_count` retains the variables through iterations so we assign to 0 the first time.
Severity: Minor
Found in app/shared/github_handler.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 initialize has 46 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def initialize(
      git_config: nil,
      local_folder: nil,
      provider_credential: nil,
      async_start: false,
Severity: Minor
Found in app/shared/models/git_repo.rb - About 1 hr to fix

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

        def setup_build_specific_environment_variables
          @environment_variables_set = []
    
          # Set the CI specific Environment variables first
          build_url = File.join(
    Severity: Minor
    Found in app/features/build_runner/build_runner.rb - About 1 hr to fix

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

          def store!(artifact:, build:, project:)
            raise "Artifact to store was not provided or wrong type provided" unless artifact&.is_a?(Artifact)
            raise "Build was not provided or wrong type provided" unless build&.is_a?(Build)
            raise "Project was not provided or wrong type provided" unless project&.is_a?(Project)
      
      
      Severity: Minor
      Found in app/shared/models/local_artifact_provider.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 run_pending_github_builds has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

          def self.run_pending_github_builds(projects: nil, github_service: nil)
            logger.debug("Searching all projects for commits with pending status that need a new build")
            # For each project, rerun all builds with the status of "pending"
            projects.each do |project|
              # Don't enqueue builds for the open pull requests if we don't have a pull request trigger defined for it
      Severity: Minor
      Found in launch.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 github_action has 43 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def github_action(client, &block)
            if client.kind_of?(Octokit::Client)
              # Inject Faraday::Request::Retry to the client if necessary
              client = inject_retry_middleware(client)
              # `rate_limit_retry_count` retains the variables through iterations so we assign to 0 the first time.
      Severity: Minor
      Found in app/shared/github_handler.rb - About 1 hr to fix

        Method install_xcode! has 43 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def install_xcode!(version:, success_block: nil, error_block: nil)
              raise "Please only pass `Gem::Version` to `install_xcode!`" unless version.kind_of?(Gem::Version)
        
              apple_id_credentials_block do
                unless installer.exist?(version)
        Severity: Minor
        Found in app/services/xcode_manager_service.rb - About 1 hr to fix

          Method install_xcode! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def install_xcode!(version:, success_block: nil, error_block: nil)
                raise "Please only pass `Gem::Version` to `install_xcode!`" unless version.kind_of?(Gem::Version)
          
                apple_id_credentials_block do
                  unless installer.exist?(version)
          Severity: Minor
          Found in app/services/xcode_manager_service.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 configuration_repository_valid? has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def configuration_repository_valid?
                # Return cached true value, if it was successful, otherwise keep checking because it might have been fixed
                return @config_repo_exists unless @config_repo_exists.nil? || (@config_repo_exists == false)
          
                valid = configuration_repository_exists?
          Severity: Minor
          Found in app/services/configuration_repository_service.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 set_build_status! has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
          Open

              def set_build_status!(repo: nil, sha: nil, state: nil, target_url: nil, description: nil, status_context:)
                status_context = GitHubService.status_context_prefix + status_context
                state = state.to_s
          
                available_states = [
          Severity: Minor
          Found in app/services/code_hosting/git_hub_service.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 set_build_status! has 37 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def set_build_status!(repo: nil, sha: nil, state: nil, target_url: nil, description: nil, status_context:)
                status_context = GitHubService.status_context_prefix + status_context
                state = state.to_s
          
                available_states = [
          Severity: Minor
          Found in app/services/code_hosting/git_hub_service.rb - About 1 hr to fix

            Method run_pending_github_builds has 36 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def self.run_pending_github_builds(projects: nil, github_service: nil)
                  logger.debug("Searching all projects for commits with pending status that need a new build")
                  # For each project, rerun all builds with the status of "pending"
                  projects.each do |project|
                    # Don't enqueue builds for the open pull requests if we don't have a pull request trigger defined for it
            Severity: Minor
            Found in launch.rb - About 1 hr to fix

              Method initialize has 35 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def initialize
                    @mutex = Mutex.new
                    @busy = false
                    # TODO: do we need a thread here to do the work or does `scheduler.schedule` handle that?
                    @thread = Thread.new do
              Severity: Minor
              Found in app/workers/worker_base.rb - About 1 hr to fix

                Method jwt has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def jwt
                        authorization = request.env["HTTP_AUTHORIZATION"]
                        bearer_token = authorization && authorization.slice(7..-1) # strip off the `Bearer `
                
                        # give the option to pass the bearer token as a query param.
                Severity: Minor
                Found in app/features-json/api_controller.rb - About 1 hr to fix

                  Method call has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def call(env)
                        unless Faye::WebSocket.websocket?(env)
                          # This is a regular HTTP call (no socket connection)
                          # so just redirect to the user's app
                          return @app.call(env)
                  Severity: Minor
                  Found in app/features/build/build_websocket_backend.rb - About 1 hr to fix

                    Method environment_variables_for_worker has 33 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def environment_variables_for_worker
                          # Set the CI specific Environment variables first
                    
                          # We try to follow the existing formats
                          # https://wiki.jenkins.io/display/JENKINS/Building+a+software+project
                    Severity: Minor
                    Found in app/features/build_runner/remote_runner.rb - About 1 hr to fix

                      Method execute_update has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def execute_update
                            tools_to_update = [GEM_NAME]
                            updater = Gem::CommandManager.instance[:update]
                            cleaner = Gem::CommandManager.instance[:cleanup]
                      
                      
                      Severity: Minor
                      Found in app/services/update_fastlane_ci_service.rb - About 1 hr to fix

                        Function exports has 32 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        module.exports = function (config) {
                          config.set({
                            basePath: '',
                            frameworks: ['jasmine', '@angular/cli'],
                            plugins: [
                        Severity: Minor
                        Found in karma.conf.js - About 1 hr to fix

                          Method ensure_logged_in has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def ensure_logged_in(route = nil)
                                if route.nil?
                                  if defined?(self::HOME)
                                    route = "#{self::HOME}*"
                                  else
                          Severity: Minor
                          Found in app/shared/authentication_request_checker.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 to_object_dictionary has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                          Open

                                def to_object_dictionary(ignore_instance_variables: [])
                                  object_hash = {}
                                  instance_variables.each do |var|
                                    next if ignore_instance_variables.include?(var)
                                    # If we encounter with a `var` which value is an `Array`, we should iterate
                          Severity: Minor
                          Found in app/shared/json_convertible.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