Compass/compass

View on GitHub

Showing 168 of 168 total issues

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

    def add_support(function, *aspects)
      aspects.each do |aspect|
        unless ASPECTS.include?(aspect)
          Compass::Util.compass_warn "Unknown support aspect: #{aspect}"
          next
Severity: Minor
Found in core/lib/compass/browser_support.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 stylesheet_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def stylesheet_path(ss)
  possible_names = possible_filenames_for_stylesheet(ss)
  import_paths.each do |import_path|
    possible_names.each do |filename|
      full_path = File.join(import_path.first, filename)
Severity: Minor
Found in compass-style.org/lib/stylesheets.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 color_stops_in_percentages has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def color_stops_in_percentages(color_list)
      assert_type color_list, :List
      color_list = normalize_stops(color_list)
      max = color_list.value.last.stop
      last_value = nil
Severity: Minor
Found in core/lib/compass/core/sass_extensions/functions/gradient_support.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 compile_if_required has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

    def compile_if_required(sass_filename, css_filename, sourcemap_filename = nil)
      if should_compile?(sass_filename, css_filename, sourcemap_filename)
        compile sass_filename, css_filename, sourcemap_filename
      else
        logger.record :unchanged, basename(sass_filename) unless options[:quiet]
Severity: Minor
Found in cli/lib/compass/compiler.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 to_sass_engine_options has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def to_sass_engine_options
        engine_opts = {:load_paths => sass_load_paths}
        engine_opts[:style] = output_style if output_style
        engine_opts[:line_comments] = line_comments
        if sass_3_4?
Severity: Minor
Found in core/lib/compass/configuration/adapters.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 configure_sass_plugin! has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def configure_sass_plugin!
        require 'sass/plugin'
        config = sass_plugin_configuration
        locations = config.delete(:template_location)
        Sass::Plugin.options.merge!(config)
Severity: Minor
Found in cli/lib/compass/configuration/helpers.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 add_import_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def add_import_path(*paths)
        paths.map!{|p| defined?(Pathname) && Pathname === p ? p.to_s : p}
        # The @added_import_paths variable works around an issue where
        # the additional_import_paths gets overwritten during parse
        @added_import_paths ||= []
Severity: Minor
Found in core/lib/compass/configuration/data.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 included has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def self.included(base)
    base.send(:include, StylesheetUrl) unless has?(base, :stylesheet_url)
    base.send(:include, FontUrl) unless has?(base, :font_url)
    base.send(:include, ImageUrl) unless has?(base, :image_url)
    base.send(:include, GeneratedImageUrl) unless has?(base, :generated_image_url)
Severity: Minor
Found in core/lib/compass/core/sass_extensions/functions/urls.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 asset_cache_buster has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def asset_cache_buster(simple = nil, &block)
        @set_attributes ||= {}
        if block_given?
          @set_attributes[:asset_cache_buster] = true
          @asset_cache_buster = block
Severity: Minor
Found in core/lib/compass/configuration/data.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 all_mixins has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def all_mixins
  @items.inject([]) do |all_mixins, item|
    next all_mixins unless item.identifier =~ %r{/reference}
    next all_mixins unless item[:stylesheet]
    all_mixins += mixins(item).map{|m| [item, m] }
Severity: Minor
Found in compass-style.org/lib/stylesheets.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 all_functions has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def all_functions
  @items.inject([]) do |all_functions, item|
    next all_functions unless item.identifier =~ %r{/reference}
    next all_functions unless item[:stylesheet]
    all_functions += functions(item).map{|f| [item, f] }
Severity: Minor
Found in compass-style.org/lib/stylesheets.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 cache_busted_path has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def cache_busted_path(path, real_path)
    cache_buster = compute_cache_buster(path, real_path)
    if cache_buster.nil?
      return path
    elsif cache_buster.is_a?(String)
Severity: Minor
Found in core/lib/compass/core/sass_extensions/functions/urls.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 browser_ranges has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def browser_ranges(capability, prefix = nil, include_unprefixed_versions = true)
    assert_valid_capability capability
    browsers = prefix.nil? ? browsers() : browsers_with_prefix(prefix)
    browsers.inject({}) do |m, browser|
      browser_versions = versions(browser)
Severity: Minor
Found in core/lib/compass/core/caniuse.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 selectors has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

def selectors(item)
  sass_tree = tree(item)
  # Visitors::CheckNesting.visit(sass_tree)
  # sass_tree = Visitors::Perform.visit(sass_tree)
  selectors = []
Severity: Minor
Found in compass-style.org/lib/stylesheets.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

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  def current_output_file(absolute = NOT_ABSOLUTE)
    if absolute.to_bool
      identifier(options[:css_filename].to_s)
    else
      filename = Pathname.new(options[:css_filename].to_s)
Severity: Minor
Found in core/lib/compass/core/sass_extensions/functions/env.rb and 1 other location - About 40 mins to fix
core/lib/compass/core/sass_extensions/functions/env.rb on lines 27..34

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 38.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  def current_source_file(absolute = NOT_ABSOLUTE)
    if absolute.to_bool
      identifier(options[:original_filename].to_s)
    else
      filename = Pathname.new(options[:original_filename].to_s)
Severity: Minor
Found in core/lib/compass/core/sass_extensions/functions/env.rb and 1 other location - About 40 mins to fix
core/lib/compass/core/sass_extensions/functions/env.rb on lines 40..47

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 38.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Consider simplifying this complex logical expression.
Open

      unless Sass::Script::Value::Color === color ||
             Sass::Script::Tree::Funcall === color ||
             (Sass::Script::Value::String === color && color.value == "currentColor")||
             (Sass::Script::Value::String === color && color.value == "transparent")
        raise Sass::SyntaxError, "Expected a color. Got: #{color}"
Severity: Major
Found in core/lib/compass/core/sass_extensions/functions/gradient_support.rb - About 40 mins to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def new_standard_arguments(options = self.options)
          if shape_and_size
            "#{array_to_s(shape_and_size, options)} at #{array_to_s(position, options)}, #{array_to_s(color_stops, options)}"
          elsif position
            "#{array_to_s(position, options)}, #{array_to_s(color_stops, options)}"
    core/lib/compass/core/sass_extensions/functions/gradient_support.rb on lines 343..350

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

        def old_standard_arguments(options = self.options)
          if shape_and_size
            "#{array_to_s(position, options)}, #{array_to_s(shape_and_size, options)}, #{array_to_s(color_stops, options)}"
          elsif position
            "#{array_to_s(position, options)}, #{array_to_s(color_stops, options)}"
    core/lib/compass/core/sass_extensions/functions/gradient_support.rb on lines 333..340

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 37.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Method sprite_position has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def sprite_position(map, sprite = nil, offset_x = ZERO, offset_y = ZERO, use_percentages = BOOL_FALSE)
    Severity: Minor
    Found in cli/lib/compass/sass_extensions/functions/sprites.rb - About 35 mins to fix
      Severity
      Category
      Status
      Source
      Language