Showing 80 of 167 total issues

File git_repo.rb has 551 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "git"
require "tty-command"
require "securerandom"
require "digest"
require "task_queue"
Severity: Major
Found in app/shared/models/git_repo.rb - About 1 day to fix

    Method setup_repo has a Cognitive Complexity of 45 (exceeds 5 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: Minor
    Found in app/shared/models/git_repo.rb - About 6 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 run has 134 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run(new_line_block:, completion_block:)
          if lane.nil?
            raise "Before calling `.run` on #{self}, you have to call `.setup` to finish preparing the BuildRunner"
          end
    
    
    Severity: Major
    Found in app/features/build_runner/fastlane_build_runner.rb - About 5 hrs to fix

      Method run has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
      Open

          def run(new_line_block:, completion_block:)
            if lane.nil?
              raise "Before calling `.run` on #{self}, you have to call `.setup` to finish preparing the BuildRunner"
            end
      
      
      Severity: Minor
      Found in app/features/build_runner/fastlane_build_runner.rb - About 4 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 GitRepo has 31 methods (exceeds 20 allowed). Consider refactoring.
      Open

        class GitRepo
          # rubocop:enable Metrics/ClassLength
          include FastlaneCI::Logging
      
          DEFAULT_REMOTE = "origin"
      Severity: Minor
      Found in app/shared/models/git_repo.rb - About 3 hrs to fix

        File build_runner.rb has 304 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        require_relative "../../shared/models/artifact"
        require_relative "./build_runner_output_row"
        
        # ideally we'd have a nicer way to inject this
        require_relative "../../features/build/build_controller"
        Severity: Minor
        Found in app/features/build_runner/build_runner.rb - About 3 hrs to fix

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

            class Services
              class << self
                include FastlaneCI::Logging
              end
          
          
          Severity: Minor
          Found in app/services/services.rb - About 2 hrs to fix

            Method initialize has a Cognitive Complexity of 19 (exceeds 5 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 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

            File add-project-dialog.component.spec.ts has 272 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            import {CommonModule} from '@angular/common';
            import {DebugElement} from '@angular/core';
            import {async, ComponentFixture, fakeAsync, TestBed} from '@angular/core/testing';
            import {FormsModule, ReactiveFormsModule} from '@angular/forms';
            import {MatButtonModule, MatDialogModule, MatDialogRef, MatIconModule, MatProgressSpinnerModule, MatSelectModule} from '@angular/material';

              Class FastlaneCIOutput has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

                class FastlaneCIOutput < FastlaneCore::Interface
                  # The block being called for each new line that should
                  # be stored in the log.
                  attr_reader :each_line_block
              
              

                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

                              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

                                Severity
                                Category
                                Status
                                Source
                                Language