Showing 167 of 167 total issues

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

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

      export class Artifact {
        readonly id: string;
        readonly name: string;
      
        constructor(artifact: BuildArtifactResponse) {
      Severity: Major
      Found in web/app/models/artifact.ts and 1 other location - About 1 hr to fix
      web/app/models/repository.ts on lines 6..14

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

      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

      export class Repository {
        readonly fullName: string;
        readonly url: string;
      
        constructor(repository: RepositoryResponse) {
      Severity: Major
      Found in web/app/models/repository.ts and 1 other location - About 1 hr to fix
      web/app/models/artifact.ts on lines 3..11

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

      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

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

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

                it('should show correct nightly trigger option name', () => {
                  component.form.patchValue({'trigger': 'nightly'});
                  fixture.detectChanges();
            
                  expect(triggerSelectEl.textContent).toBe('nightly');
            web/app/dashboard/add-project-dialog/add-project-dialog.component.spec.ts on lines 211..216
            web/app/dashboard/add-project-dialog/add-project-dialog.component.spec.ts on lines 218..223

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

            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 3 locations. Consider refactoring.
            Open

                it('should show correct commit option name', () => {
                  component.form.patchValue({'trigger': 'commit'});
                  fixture.detectChanges();
            
                  expect(triggerSelectEl.textContent).toBe('for every commit');
            web/app/dashboard/add-project-dialog/add-project-dialog.component.spec.ts on lines 204..209
            web/app/dashboard/add-project-dialog/add-project-dialog.component.spec.ts on lines 218..223

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

            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 3 locations. Consider refactoring.
            Open

                it('should show correct PR option name', () => {
                  component.form.patchValue({'trigger': 'pull_request'});
                  fixture.detectChanges();
            
                  expect(triggerSelectEl.textContent).toBe('for every pull request');
            web/app/dashboard/add-project-dialog/add-project-dialog.component.spec.ts on lines 204..209
            web/app/dashboard/add-project-dialog/add-project-dialog.component.spec.ts on lines 211..216

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

            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

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

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

                      for (const status of COMPLETE_STATUSES) {
                        it(`should be true for status: ${status}`, () => {
                          expect(getBuildWithStatus(status).isComplete()).toBe(true);
                        });
                      }
                  Severity: Major
                  Found in web/app/models/build.spec.ts and 1 other location - About 1 hr to fix
                  web/app/models/build.spec.ts on lines 54..58

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

                  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

                      for (const status of RUNNING_STATUSES) {
                        it(`should be false for status: ${status}`, () => {
                          expect(getBuildWithStatus(status).isComplete()).toBe(false);
                        });
                      }
                  Severity: Major
                  Found in web/app/models/build.spec.ts and 1 other location - About 1 hr to fix
                  web/app/models/build.spec.ts on lines 48..52

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

                  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

                          it('should have status icon', () => {
                            expect(
                                getElementText(rowEls[0], '.mat-column-number .fci-status-icon'))
                                .toBe('check_circle');
                            expect(
                  Severity: Major
                  Found in web/app/project/project.component.spec.ts and 1 other location - About 1 hr to fix
                  web/app/project/project.component.spec.ts on lines 220..225

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

                  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

                          it('should have build number', () => {
                            expect(getElementText(rowEls[0], '.mat-column-number span'))
                                .toBe('2');
                            expect(getElementText(rowEls[1], '.mat-column-number span'))
                                .toBe('1');
                  Severity: Major
                  Found in web/app/project/project.component.spec.ts and 1 other location - About 1 hr to fix
                  web/app/project/project.component.spec.ts on lines 211..218

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

                  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