Compass/compass

View on GitHub

Showing 134 of 168 total issues

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

  def compare_browser_versions(browser, version1, version2)
    assert_type browser, :String, :browser
    assert_type version1, :String, :version1
    assert_type version2, :String, :version2
    index1 = index2 = nil

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 installer has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

      def self.installer(type, installer_opts = {}, &locator)
        locator ||= lambda{|to| to}
        loc_method = "install_location_for_#{type}".to_sym
        define_method("simple_#{loc_method}", locator)
        define_method(loc_method) do |to, options|
Severity: Minor
Found in cli/lib/compass/installers/base.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 perform! has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def perform!
      $command = args.shift
      command_class = Compass::Commands[$command]
      unless command_class
        args.unshift($command)
Severity: Minor
Found in cli/lib/compass/exec/sub_command_ui.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 grad_point has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def grad_point(position)
      original_value = position
      position = unless position.is_a?(Sass::Script::Value::List)
        opts(list([position], :space))
      else
Severity: Minor
Found in core/lib/compass/core/sass_extensions/functions/gradient_support.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 opposite_position has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def opposite_position(position)
    position = unless position.is_a?(Sass::Script::Value::List)
      list(position, :space)
    else
      list(position.value.dup, position.separator)
Severity: Minor
Found in core/lib/compass/core/sass_extensions/functions/constants.rb - About 1 hr to fix

    Function cookie has 35 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    jQuery.cookie = function(name, value, options) {
        if (typeof value != 'undefined') { // name and value given, set cookie
            options = options || {};
            if (value === null) {
                value = '';
    Severity: Minor
    Found in compass-style.org/assets/javascripts/jquery.cookie.js - About 1 hr to fix

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

          def font_url(path, only_path = bool(false), cache_buster = bool(true))
            path = path.value # get to the string value of the literal.
      
            # Short curcuit if they have provided an absolute url.
            if absolute_path?(path)
      Severity: Minor
      Found in core/lib/compass/core/sass_extensions/functions/urls.rb - About 1 hr to fix

        Method item_tree has 33 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        def item_tree(item, options = {})
          crumb = item[:crumb] || item[:title]
          options[:heading_level] ||= 1 if options.fetch(:headings, true)
          child_html = ""
          if options.fetch(:depth,1) > 0
        Severity: Minor
        Found in compass-style.org/lib/default.rb - About 1 hr to fix

          Method set_options has 32 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def set_options(opts)
          
                  if $command == "create"
                    opts.banner = %Q{
                      Usage: compass create path/to/project [options]
          Severity: Minor
          Found in cli/lib/compass/commands/create_project.rb - About 1 hr to fix

            Method serialize has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def serialize
                    contents = ""
                    (required_libraries || []).each do |lib|
                      contents << %Q{require '#{lib}'\n}
                    end
            Severity: Minor
            Found in cli/lib/compass/configuration/serialization.rb - About 1 hr to fix

              Method grad_point has 32 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def grad_point(position)
                    original_value = position
                    position = unless position.is_a?(Sass::Script::Value::List)
                      opts(list([position], :space))
                    else
              Severity: Minor
              Found in core/lib/compass/core/sass_extensions/functions/gradient_support.rb - About 1 hr to fix

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

                      def configuration_for(config, filename = nil, defaults = nil)
                        if config.nil?
                          nil
                        elsif config.is_a?(Compass::Configuration::Data)
                          config
                Severity: Minor
                Found in cli/lib/compass/configuration/helpers.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 compute_cache_buster has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
                Open

                  def compute_cache_buster(path, real_path)
                    file = nil
                    if Compass.configuration.asset_cache_buster
                      args = [path]
                      if Compass.configuration.asset_cache_buster.arity > 1
                Severity: Minor
                Found in core/lib/compass/core/sass_extensions/functions/urls.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

                Function Brush has 31 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                    function Brush()
                    {
                        function process(match, regexInfo)
                        {
                            var constructor = SyntaxHighlighter.Match,
                Severity: Minor
                Found in compass-style.org/assets/javascripts/shBrushXml.js - About 1 hr to fix

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

                        def perform
                          if options[:display]
                            if Compass.configuration.respond_to?(options[:display])
                              puts Compass.configuration.send(options[:display])
                            else
                  Severity: Minor
                  Found in cli/lib/compass/commands/write_configuration.rb - About 1 hr to fix

                    Method normalize_stops has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        def normalize_stops(color_list)
                          positions = color_list.value.map{|obj| obj.dup}
                          # fill in the start and end positions, if unspecified
                          positions.first.stop = number(0) unless positions.first.stop
                          positions.last.stop = number(100, "%") unless positions.last.stop
                    Severity: Minor
                    Found in core/lib/compass/core/sass_extensions/functions/gradient_support.rb - About 1 hr to fix

                      Method sprite_position has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def sprite_position(map, sprite = nil, offset_x = ZERO, offset_y = ZERO, use_percentages = BOOL_FALSE)
                          assert_type offset_x, :Number
                          assert_type offset_y, :Number
                          sprite = convert_sprite_name(sprite)
                          verify_map(map, "sprite-position")
                      Severity: Minor
                      Found in cli/lib/compass/sass_extensions/functions/sprites.rb - About 1 hr to fix

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

                            def pretty_print(skip_patterns = false)
                              result = ""
                              max = Compass::Frameworks::ALL.inject(0) do |gm, framework|
                                fm = framework.template_directories.inject(0) do |lm,pattern|
                                  [lm, 7 + framework.name.size + pattern.size].max
                        Severity: Minor
                        Found in core/lib/compass/frameworks.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 parse_string has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                              def parse_string(contents, filename)
                                bind = get_binding
                                eval(contents, bind, filename)
                                local_vars_set = eval("local_variables", bind)
                                local_vars_set.each do |local_var|
                        Severity: Minor
                        Found in cli/lib/compass/configuration/serialization.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 functions has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                        Open

                        def functions(item)
                          sass_tree = tree(item)
                          functions = []
                          comment = nil
                          sass_tree.children.each do |child|
                        Severity: Minor
                        Found in compass-style.org/lib/stylesheets.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

                        Severity
                        Category
                        Status
                        Source
                        Language