Showing 167 of 167 total issues

Method setup_repo has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def setup_repo
      retry_count ||= 0
      if File.directory?(local_folder)
        # TODO: test if this crashes if it's not a git directory
        begin
Severity: Major
Found in app/shared/models/git_repo.rb - About 2 hrs to fix

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

      class BuildRunner
        include FastlaneCI::Logging
    
        # Reference to the FastlaneCI::Project of this particular build run
        attr_reader :project
    Severity: Minor
    Found in app/features/build_runner/build_runner.rb - About 2 hrs to fix

      Method handle_exception has 57 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def handle_exception(ex, console_message: nil, exception_context: {})
            unless console_message.nil?
              logger.error(console_message)
            end
            logger.error(ex)
      Severity: Major
      Found in app/shared/models/git_repo.rb - About 2 hrs to fix

        File project.component.spec.ts has 257 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import 'rxjs/add/operator/switchMap';
        
        import {Location} from '@angular/common';
        import {DebugElement} from '@angular/core';
        import {async, ComponentFixture, fakeAsync, flush, TestBed, tick} from '@angular/core/testing';
        Severity: Minor
        Found in web/app/project/project.component.spec.ts - About 2 hrs to fix

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

            class RemoteRunner
              include FastlaneCI::Logging
          
              # this record separator is used to delimit the history file.
              # if for whatever reason, we can't delimit on newlines, consider \30 the Record Separator char.
          Severity: Minor
          Found in app/features/build_runner/remote_runner.rb - About 2 hrs to fix

            File build.component.spec.ts has 256 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {DebugElement, Component} from '@angular/core';
            import {Location} from '@angular/common';
            import {async, ComponentFixture, TestBed, tick, fakeAsync} from '@angular/core/testing';
            import {MatCardModule, MatProgressSpinnerModule} from '@angular/material';
            import {By} from '@angular/platform-browser';
            Severity: Minor
            Found in web/app/build/build.component.spec.ts - About 2 hrs to fix

              Method setup_tooling_environment? has 53 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def setup_tooling_environment?
                    xcode_version_file_path = File.join(repo.local_folder, ".xcode-version")
                    unless File.exist?(xcode_version_file_path)
                      logger.debug("No `.xcode-version` file found for repo '#{project.project_name}', " \
                                   "not managing Xcode for this one...")
              Severity: Major
              Found in app/features/build_runner/fastlane_build_runner.rb - About 2 hrs to fix

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

                    def commit_changes!(commit_message: nil, push_after_commit: true, files_to_commit: [], repo_auth: self.repo_auth)
                      git_action_with_queue do
                        logger.debug("Starting commit_changes! #{git_config.git_url} for #{repo_auth.username}")
                        commit_message ||= "Automatic commit by fastlane.ci"
                
                
                Severity: Minor
                Found in app/shared/models/git_repo.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

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

                describe('Repository Model', () => {
                  it('should convert project response successfully', () => {
                    const repository = new Repository(mockRepositoryResponse);
                
                    expect(repository.fullName).toBe('fastlane/ci');
                Severity: Major
                Found in web/app/models/repository.spec.ts and 1 other location - About 2 hrs to fix
                web/app/models/artifact.spec.ts on lines 5..12

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

                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

                describe('Artifact Model', () => {
                  it('should convert build artifact successfully', () => {
                    const artifact = new Artifact(mockBuildArtifactResponse_log);
                
                    expect(artifact.id).toBe('12345');
                Severity: Major
                Found in web/app/models/artifact.spec.ts and 1 other location - About 2 hrs to fix
                web/app/models/repository.spec.ts on lines 5..12

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

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

                    def start_workers_for_project_and_credential(project: nil, provider_credential: nil, notification_service:)
                      user_responsible = provider_credential.ci_user
                
                      if user_responsible.nil?
                        name = project.project_name
                Severity: Minor
                Found in app/services/worker_service.rb - About 1 hr to fix

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

                      def self.enqueue_builds_for_open_github_prs_with_no_status(projects: nil, github_service: nil)
                        logger.debug("Searching for open PRs with no status and starting a build for them")
                        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
                          next if project.find_triggers_of_type(trigger_type: :pull_request).first.nil?
                  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 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 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 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

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

                          dataService = {
                            getBuild:
                                jasmine.createSpy().and.returnValue(buildSubject.asObservable()),
                            getBuildLogs:
                                jasmine.createSpy().and.returnValue(buildLogsSubject.asObservable())
                      Severity: Major
                      Found in web/app/build/build.component.spec.ts and 2 other locations - About 1 hr to fix
                      web/app/dashboard/add-project-dialog/add-project-dialog.component.spec.ts on lines 43..48
                      web/app/project/project.component.spec.ts on lines 43..48

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

                      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

                          dataService = {
                            getProject:
                                jasmine.createSpy().and.returnValue(projectSubject.asObservable()),
                            rebuild: jasmine.createSpy().and.returnValue(
                                rebuildSummarySubject.asObservable())
                      Severity: Major
                      Found in web/app/project/project.component.spec.ts and 2 other locations - About 1 hr to fix
                      web/app/build/build.component.spec.ts on lines 45..50
                      web/app/dashboard/add-project-dialog/add-project-dialog.component.spec.ts on lines 43..48

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

                      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

                          dataService = {
                            addProject:
                                jasmine.createSpy().and.returnValue(projectSubject.asObservable()),
                            getRepoLanes:
                                jasmine.createSpy().and.returnValue(lanesSubject.asObservable())
                      web/app/build/build.component.spec.ts on lines 45..50
                      web/app/project/project.component.spec.ts on lines 43..48

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

                      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