gazazello/forcer

View on GitHub
lib/metadata_services/sfdc_directory_service.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

There are no issues that match your filters.

Category
Status