Showing 80 of 167 total issues

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

    def update_project!(project: nil)
      unless project.nil?
        raise "project must be configured with an instance of #{Project.name}" unless project.class <= Project
      end

Severity: Minor
Found in app/services/config_data_sources/json_project_data_source.rb - About 45 mins 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 fastfile_from_repo has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def fastfile_from_repo(repo_config: nil, branch: nil, sha: nil)
      git_repo = FastlaneCI::GitRepo.new(
        git_config: repo_config,
        local_folder: Dir.mktmpdir,
        provider_credential: @provider_credential,
Severity: Minor
Found in app/shared/fastfile_peeker.rb - About 35 mins 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 reload_settings has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def reload_settings
      JSONSettingDataSource.file_semaphore.synchronize do
        @settings = AvailableSettings.available_settings

        unless File.exist?(setting_file_path)
Severity: Minor
Found in app/services/data_sources/json_setting_data_source.rb - About 35 mins 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def run
      # send logs that get put on the output queue.
      # this needs to be on a separate thread since Queue is a threadsafe blocking queue.
      Thread.new do
        while state == "running"
Severity: Minor
Found in agent/invocation.rb - About 35 mins 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_all_open_prs_without_status_to_pending_status! has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def update_all_open_prs_without_status_to_pending_status!(repo_full_name: nil, status_context: nil)
      open_pr_commits = open_pull_requests(repo_full_name: repo_full_name)
      updated_commits = []

      open_pr_commits.each do |open_pull_request|
Severity: Minor
Found in app/services/code_hosting/git_hub_service.rb - About 35 mins 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 reload_notifications has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def reload_notifications
      JSONNotificationDataSource.file_semaphore.synchronize do
        @notifications =
          if !File.exist?(notifications_file_path)
            notifications_dirname = File.dirname(notifications_file_path)
Severity: Minor
Found in app/services/data_sources/json_notification_data_source.rb - About 35 mins 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 ensure_proper_setup has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def ensure_proper_setup(route = nil)
      route = "#{self::HOME}*" if route.nil?

      before(route) do
        if !route.start_with?("/onboarding_erb") && !Services.onboarding_service.correct_setup?
Severity: Minor
Found in app/shared/setup_checker.rb - About 35 mins 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 call has a Cognitive Complexity of 7 (exceeds 5 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 35 mins 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 checkout_commit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def checkout_commit(sha: nil, repo_auth: self.repo_auth, use_global_git_mutex: true, completion_block: nil)
      perform_block(use_global_git_mutex: use_global_git_mutex) do
        repo_url = git_config.git_url
        logger.info("Checking out sha: #{sha} from #{repo_url}")
        setup_auth(repo_auth: repo_auth)
Severity: Minor
Found in app/shared/models/git_repo.rb - About 35 mins 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

Avoid too many return statements within this method.
Open

      return false
Severity: Major
Found in app/services/configuration_repository_service.rb - About 30 mins to fix

    Method setup_build_specific_environment_variables has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 validate_initialization_params! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def validate_initialization_params!(
          git_config: nil,
          local_folder: nil,
          provider_credential: nil,
          async_start: nil,
    Severity: Minor
    Found in app/shared/models/git_repo.rb - About 25 mins 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 retrieve! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def retrieve!(artifact:)
          raise "Artifact to store was not provided or wrong type provided" unless artifact&.is_a?(Artifact)
    
          if File.exist?(artifact.reference)
            artifact_reference = artifact.reference
    Severity: Minor
    Found in app/shared/models/local_artifact_provider.rb - About 25 mins 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 open_pull_requests has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def open_pull_requests(repo_full_name: nil, branches: nil)
          all_open_pull_requests = []
          github_action(client) do |c|
            all_open_pull_requests = c.pull_requests(repo_full_name, state: "open").map do |pr|
              # This can happen, not sure why, seems to do with other people's forks, maybe they don't exist?
    Severity: Minor
    Found in app/services/code_hosting/git_hub_service.rb - About 25 mins 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 user_has_valid_github_token? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def user_has_valid_github_token?(provider_credentials: [])
          provider_credentials.each do |provider_credential|
            if provider_credential.type == FastlaneCI::ProviderCredential::PROVIDER_CREDENTIAL_TYPES[:github]
              if provider_credential.api_token.nil?
                return false
    Severity: Minor
    Found in app/features/login/login_controller.rb - About 25 mins 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 setup_tooling_environment? has a Cognitive Complexity of 6 (exceeds 5 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: Minor
    Found in app/features/build_runner/fastlane_build_runner.rb - About 25 mins 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 environment_variables_for_worker has a Cognitive Complexity of 6 (exceeds 5 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 25 mins 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 required_keys_and_proper_remote_configuration_repo? has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def required_keys_and_proper_remote_configuration_repo?
          return @setup_correctly unless @setup_correctly.nil?
    
          unless no_missing_keys?
            logger.debug("Missing environment variables.")
    Severity: Minor
    Found in app/services/onboarding_service.rb - About 25 mins 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 viewmodel_from! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

          def viewmodel_from!(object:)
            raise "Override base_model(model) in order to use the ViewModel mixin." if @base_model.nil?
            raise "Incorrect object type. Expected #{@base_model}, got #{object.class}" unless object.kind_of?(@base_model)
            if object.respond_to?(:to_object_dictionary)
              instance_variables = @base_model.instance_variables
    Severity: Minor
    Found in app/features-json/view_models/view_model.rb - About 25 mins 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 pre_run_action has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
    Open

        def pre_run_action(&completion_block)
          logger.debug("Running pre_run_action in checkout_sha")
    
          checkout_sha do |checkout_success|
            if checkout_success
    Severity: Minor
    Found in app/features/build_runner/build_runner.rb - About 25 mins 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