gazazello/forcer

View on GitHub

Showing 10 of 10 total issues

Method filter_xml has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring.
Open

    def filter_xml(filename)
      prepare_xml_nodes_to_exclude if @snippets_to_exclude.nil?
      doc = Nokogiri::XML(File.read(filename))
      file_modified = false
      @snippets_to_exclude.each do |suffix, expressions|
Severity: Minor
Found in lib/metadata_services/sfdc_directory_service.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 write_entries has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
Open

    def write_entries(entries, path)
      entries.each do |entry|
        # need relative local file path to use in new zip file too
        zip_file_path = (path == "" ? entry : File.join(path, entry)) # maybe without if/else
        next if exclude_file?(zip_file_path.downcase)
Severity: Minor
Found in lib/metadata_services/sfdc_directory_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 deploy has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def deploy
      begin
        dir_zip_service = SfdcDirectoryService.new(@args)
        @zip_name = dir_zip_service.make_project_zip
        blob_zip = Base64.encode64(File.open(@zip_name, "rb").read)
Severity: Minor
Found in lib/metadata_services/metadata_service.rb - About 1 hr to fix

    Method run_status_check has 34 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def run_status_check(ids, lambda_metadata)
          header = {
              "tns:SessionHeader" => {
                  "tns:sessionId" => ids[:session_id]
              }
    Severity: Minor
    Found in lib/utilities/status_print_service.rb - About 1 hr to fix

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

          def run_status_check(ids, lambda_metadata)
            header = {
                "tns:SessionHeader" => {
                    "tns:sessionId" => ids[:session_id]
                }
      Severity: Minor
      Found in lib/utilities/status_print_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 verify_options has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def verify_options(old_options = {})
              p "verifying deployment information"
              new_options = ActionOptionsService.load_config(old_options)
              new_options[:host] ||=  "https://" + ask("Enter org url (test.salesforce.org or login.salesforce.org): ")
              new_options[:username] ||= ask("Enter username: ")
      Severity: Minor
      Found in lib/forcer_main.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 load_login_info has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

            def load_login_info(options = {})
      
              config_file_path = get_config_file_path(options)
      
              # don't raise exception and let user enter all necessary information
      Severity: Minor
      Found in lib/utilities/action_options_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 xml_exclusion_skipped_for? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def xml_exclusion_skipped_for?(full_filename)
            raise Exception if (full_filename.nil? or full_filename.empty?)
            return true if @args[:skipExclude]
      
            if full_filename.end_with?("package.xml")
      Severity: Minor
      Found in lib/metadata_services/sfdc_directory_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 deploy has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def deploy
            begin
              dir_zip_service = SfdcDirectoryService.new(@args)
              @zip_name = dir_zip_service.make_project_zip
              blob_zip = Base64.encode64(File.open(@zip_name, "rb").read)
      Severity: Minor
      Found in lib/metadata_services/metadata_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 find_source_dir has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def find_source_dir
            raise Exception unless Dir.exists?(@args[:source])
            @input_dir_name = ""
            Find.find(@args[:source]) do |entry|
              if entry.end_with?("src") && File.directory?(entry)
      Severity: Minor
      Found in lib/metadata_services/sfdc_directory_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

      Severity
      Category
      Status
      Source
      Language