Octo-Labs/middleman-automatic-clowncar

View on GitHub

Showing 8 of 8 total issues

Method get_image_path has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def get_image_path(name, path, is_relative, fallback_host)
        #puts "@@@@@@@ calling get_image_path for name:#{name} path:#{path}, is_relative:#{is_relative}, fallback_host:#{fallback_host}"
        begin
          uri = URI(path)
        rescue URI::InvalidURIError
Severity: Minor
Found in lib/middleman-automatic-clowncar/extension.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 manipulate_resource_list has 26 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def manipulate_resource_list(resources)
        puts "resources = #{resources.class}"
        options = Extension.options_hash
        sizes = options[:sizes]
        namespace = options[:namespace_directory].join(',')
Severity: Minor
Found in lib/middleman-automatic-clowncar/sitemap-extension.rb - About 1 hr to fix

    Method generate_svg has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
    Open

          def generate_svg(name, is_relative, options)
            sizes, width, height = get_image_sizes(name, options)
    
            fallback_host = false
            if is_relative
    Severity: Minor
    Found in lib/middleman-automatic-clowncar/extension.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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
    Open

          def initialize(store, path, dimensions, origin, root_path, build_dir, source_dir)
    Severity: Major
    Found in lib/middleman-automatic-clowncar/thumbnail-resource.rb - About 50 mins to fix

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

              def automatic_clowncar_tag(name, options={})
                internal = ""
      
                if options[:fallback]
                  fallback = File.basename thumbnail_url(name,:small)
      Severity: Minor
      Found in lib/middleman-automatic-clowncar/extension.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 manipulate_resource_list has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def manipulate_resource_list(resources)
              puts "resources = #{resources.class}"
              options = Extension.options_hash
              sizes = options[:sizes]
              namespace = options[:namespace_directory].join(',')
      Severity: Minor
      Found in lib/middleman-automatic-clowncar/sitemap-extension.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 get_image_sizes has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

            def get_image_sizes(name, options)
              #puts "getting images sizes for #{name}"
      
              main_abs_path = File.join(app.source_dir,name)
      
      
      Severity: Minor
      Found in lib/middleman-automatic-clowncar/extension.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 render has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def render(*args, &block)
              output_dir = File.join(@root_path,@build_dir)
              dest_path = File.join(output_dir,@path)
              img = nil
              if Utils.timestamp_current?(@source_dir,@build_dir,@origin) && File.exist?(dest_path)
      Severity: Minor
      Found in lib/middleman-automatic-clowncar/thumbnail-resource.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