chriseppstein/compass

View on GitHub

Showing 167 of 167 total issues

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

;(function()
{
    // CommonJS
    typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;

Severity: Major
Found in compass-style.org/assets/javascripts/shBrushScss.js and 1 other location - About 3 days to fix
compass-style.org/assets/javascripts/shBrushCss.js on lines 17..91

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

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

;(function()
{
    // CommonJS
    typeof(require) != 'undefined' ? SyntaxHighlighter = require('shCore').SyntaxHighlighter : null;

Severity: Major
Found in compass-style.org/assets/javascripts/shBrushCss.js and 1 other location - About 3 days to fix
compass-style.org/assets/javascripts/shBrushScss.js on lines 17..91

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

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

File gradient_support.rb has 727 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Compass::Core::SassExtensions::Functions::GradientSupport

  GRADIENT_ASPECTS = %w(webkit moz svg css2 o owg).freeze

  class CSS3AngleToSVGConverter
Severity: Major
Found in core/lib/compass/core/sass_extensions/functions/gradient_support.rb - About 1 day to fix

    Function showInstallCommand has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring.
    Open

    function showInstallCommand() {
        var cmd = $("#existence").val();
        var commands = [];
        var notes = [];
        var project_name = "<myproject>";
    Severity: Minor
    Found in compass-style.org/assets/javascripts/install.js - About 5 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 add_sass_configuration has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring.
    Open

      def add_sass_configuration(project_path)
        css_location = template_location = nil
        if options[:template_location] && options[:template_location].is_a?(Array)
          css_location = File.expand_path(options[:template_location].first.last)
          template_location = File.expand_path(options[:template_location].first.first)
    Severity: Minor
    Found in core/lib/compass/core/sass_extensions/functions/configuration.rb - About 4 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

    Function cookie has a Cognitive Complexity of 29 (exceeds 5 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 4 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 perform has a Cognitive Complexity of 28 (exceeds 5 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 4 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

    Function showInstallCommand has 93 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    function showInstallCommand() {
        var cmd = $("#existence").val();
        var commands = [];
        var notes = [];
        var project_name = "<myproject>";
    Severity: Major
    Found in compass-style.org/assets/javascripts/install.js - About 3 hrs to fix

      Method normalize_stops has a Cognitive Complexity of 25 (exceeds 5 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 3 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 sprite_position has a Cognitive Complexity of 24 (exceeds 5 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 3 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 item_tree has a Cognitive Complexity of 24 (exceeds 5 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 3 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 make_cache_buster_proc has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.make_cache_buster_proc(v, ctx)
          proc do |url, file|
            if ctx.environment.function(v.value) || Sass::Script::Functions.callable?(v.value.tr('-', '_'))
              result = ctx.call(v, ctx.quoted_string(url),
                                   file.nil? ? ctx.null() : ctx.quoted_string(file.path))
      Severity: Minor
      Found in core/lib/compass/core/sass_extensions/functions/configuration.rb - About 3 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

      Class CanIUse has 26 methods (exceeds 20 allowed). Consider refactoring.
      Open

      class Compass::Core::CanIUse
        include Singleton
      
        DATA_FILE_NAME = File.join(Compass::Core.base_directory, "data", "caniuse.json")
        DATA_FEATURE_FILES = Dir.glob(File.join(Compass::Core.base_directory, "data", "caniuse_extras", "**", "*.json"))
      Severity: Minor
      Found in core/lib/compass/core/caniuse.rb - About 3 hrs to fix

        Class Image has 26 methods (exceeds 20 allowed). Consider refactoring.
        Open

              class Image
                include Sass::Script::Value::Helpers
                ACTIVE = %r{[_-]active$}
                TARGET = %r{[_-]target$}
                HOVER = %r{[_-]hover$}
        Severity: Minor
        Found in cli/lib/compass/sass_extensions/sprites/image.rb - About 3 hrs to fix

          Class Compiler has 26 methods (exceeds 20 allowed). Consider refactoring.
          Open

            class Compiler
          
              include Actions
          
              attr_accessor :working_path, :from, :to, :options, :sass_options, :staleness_checker, :importer
          Severity: Minor
          Found in cli/lib/compass/compiler.rb - About 3 hrs to fix

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

                function Brush()
                {
                    function getKeywordsCSS(str)
                    {
                        return '\\b([a-z_]|)' + str.replace(/ /g, '(?=:)\\b|\\b([a-z_\\*]|\\*|)') + '(?=:)\\b';
            Severity: Major
            Found in compass-style.org/assets/javascripts/shBrushSass.js - About 2 hrs to fix

              Method scan_fit has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                      def scan_fit
                        fast_fit
              
                        moved_images = []
              
              
              Severity: Minor
              Found in cli/lib/compass/sass_extensions/sprites/row_fitter.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 handle_keywords has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
              Open

                  def handle_keywords(angle)
                    if angle.is_a?(Sass::Script::Value::List) || angle.is_a?(Sass::Script::Value::String)
                      direction = angle.to_sass
                      is_end_point = !!/\bto\b/i.match(direction)
                      dir = 0
              Severity: Minor
              Found in core/lib/compass/core/sass_extensions/functions/gradient_support.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

              File inheritance.rb has 263 lines of code (exceeds 250 allowed). Consider refactoring.
              Open

              module Compass
                module Configuration
                  # The inheritance module makes it easy for configuration data to inherit from
                  # other instances of configuration data. This makes it easier for external code to layer
                  # bits of configuration from various sources.
              Severity: Minor
              Found in core/lib/compass/configuration/inheritance.rb - About 2 hrs to fix

                Method opposite_position has a Cognitive Complexity of 16 (exceeds 5 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 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

                Severity
                Category
                Status
                Source
                Language