Showing 80 of 167 total issues

Method handle_exception has a Cognitive Complexity of 11 (exceeds 5 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: Minor
Found in app/shared/models/git_repo.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

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

      def from_json!(json_object)
        instance, json_object = _initialize_using!(json_object)
        json_object.each do |var, val|
          # If we encounter with a value that is represented by an array, iterate over it.
          if val.kind_of?(Array)
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

Method register_available_controllers has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def self.register_available_controllers
      # require all controllers
      require_relative "app/features/all"
      # Load up all the available controllers

Severity: Minor
Found in launch.rb - About 1 hr to fix

    Method enqueue_builds_for_open_github_prs_with_no_status has 31 lines of code (exceeds 25 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

      Method do_build has 31 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def do_build
            logger.debug("Running nightly build for #{project.project_name} (#{repo_full_name})")
            # TODO: build_service could be injected instead of referenced like this
            build_service = FastlaneCI::Services.build_service
      
      
      Severity: Minor
      Found in app/workers/nightly_build_github_worker.rb - About 1 hr to fix

        Method remote_file_a_json_array? has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
        Open

            def remote_file_a_json_array?(file_path)
              return false unless configuration_repository_exists?
              logger.debug("Checking that #{repo_shortform}/#{file_path} is a json array")
        
              contents_map = {}
        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 commit_changes! has 26 lines of code (exceeds 25 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 1 hr to fix

          Method start has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def start
                logger.debug("Starting build runner #{self.class} for #{project.project_name} #{project.id} sha: #{sha} now...")
                start_time = Time.now
          
                work_block = proc do
          Severity: Minor
          Found in app/features/build_runner/build_runner.rb - About 1 hr to fix

            Method store! has a Cognitive Complexity of 9 (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/gcp_artifact_provider.rb - About 55 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 fetch_available_lanes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def fetch_available_lanes(fastfile_parser)
                  # we don't want to show `_before_all_block_`, `_after_all_block_` and `_error_block_`
                  # or a private lane as an available lane
                  lanes = []
                  fastfile_parser.tree.each do |platform, value|
            Severity: Minor
            Found in app/features-json/repos_json_controller.rb - About 55 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 fetch_available_lanes has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def fetch_available_lanes(fastfile_parser)
                  # we don't want to show `_before_all_block_`, `_after_all_block_` and `_error_block_`
                  # or a private lane as an available lane
                  lanes = []
                  fastfile_parser.tree.each do |platform, value|
            Severity: Minor
            Found in app/features/project/project_controller.rb - About 55 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 _from_json! has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                  def _from_json!(var, val, is_iterable: false)
                    # TODO: attribute_key_name_map doesn't seem to be used anywhere in the code base
                    if attribute_key_name_map.key(var)
                      var_name = attribute_key_name_map.key(var).to_sym
                    else
            Severity: Minor
            Found in app/shared/json_convertible.rb - About 55 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 start has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
            Open

                def start
                  save_build_status_locally!
            
                  env = environment_variables_for_worker
                  start_time = Time.now.utc
            Severity: Minor
            Found in app/features/build_runner/remote_runner.rb - About 55 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_contents_map has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
            Open

                def fastfile_from_contents_map(contents_map)
                  github_action(@client) do |_client|
                    return nil if contents_map.nil?
            
                    if contents_map
            Severity: Minor
            Found in app/shared/fastfile_peeker.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

            Avoid deeply nested control flow statements.
            Open

                          if repo.status.changed.count > 0 ||
                             repo.status.added.count > 0 ||
                             repo.status.deleted.count > 0 ||
                             repo.status.untracked.count > 0
                            begin
            Severity: Major
            Found in app/shared/models/git_repo.rb - About 45 mins to fix

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

                  def create_project!(
                    name: nil,
                    repo_config: nil,
                    enabled: nil,
                    platform: nil,
              Severity: Minor
              Found in app/services/project_service.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 delete_project! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def delete_project!(project: nil)
                    unless project.nil?
                      raise "project must be configured with an instance of #{Project.name}" unless project.class <= Project
                    end
                    project_index = nil
              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 start has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def start
                    logger.debug("Starting build runner #{self.class} for #{project.project_name} #{project.id} sha: #{sha} now...")
                    start_time = Time.now
              
                    work_block = proc do
              Severity: Minor
              Found in app/features/build_runner/build_runner.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

              Avoid deeply nested control flow statements.
              Open

                            rescue StandardError => ex
                              handle_exception(ex, console_message: "Error commiting changes to ci-config repo")
              Severity: Major
              Found in app/shared/models/git_repo.rb - About 45 mins to fix
                Severity
                Category
                Status
                Source
                Language