chriseppstein/compass

View on GitHub

Showing 167 of 167 total issues

Method discover has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def discover(type)
        type = self.class.plural_types[type] || type
        dir = File.dirname(@manifest_file)
        Dir.glob("#{dir}/**/*").each do |file|
          next if /manifest\.rb/ =~ file
Severity: Minor
Found in cli/lib/compass/installers/manifest.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

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

      class << self

        def option_parser(arguments)
          parser = Compass::Exec::CommandOptionParser.new(arguments)
          parser.extend(Compass::Exec::GlobalOptionsParser)
Severity: Major
Found in cli/lib/compass/commands/validate_project.rb and 1 other location - About 1 hr to fix
cli/lib/compass/commands/write_configuration.rb on lines 87..118

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

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 perform has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def perform
        super
        require 'compass/stats'
        compiler = new_compiler_instance
        sass_files = sorted_sass_files(compiler)
Severity: Minor
Found in cli/lib/compass/commands/project_stats.rb - About 1 hr to fix

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

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

          function setThemePreference(theme) {
            $.cookie("compass-theme", null);
            $.cookie("compass-theme", theme, {
              expires: 60 * 60 * 24 * 365 * 10,
              path: '/'
          Severity: Major
          Found in compass-style.org/assets/javascripts/site.js and 3 other locations - About 1 hr to fix
          compass-style.org/assets/javascripts/site.js on lines 51..54
          compass-style.org/assets/javascripts/site.js on lines 56..59
          compass-style.org/assets/javascripts/site.js on lines 61..64

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

          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 4 locations. Consider refactoring.
          Open

          function setExampleMarkupSyntaxPreference (exampleMarkup) {
            $.cookie("compass-example-markup", null);
            $.cookie("compass-example-markup", exampleMarkup, { expires: 60 * 60 * 24 * 365 * 10, path: '/' });
          }
          Severity: Major
          Found in compass-style.org/assets/javascripts/site.js and 3 other locations - About 1 hr to fix
          compass-style.org/assets/javascripts/site.js on lines 34..40
          compass-style.org/assets/javascripts/site.js on lines 51..54
          compass-style.org/assets/javascripts/site.js on lines 56..59

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

          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 4 locations. Consider refactoring.
          Open

          function setStyleSyntaxPreference (mainSyntax) {
            $.cookie("compass-syntax", null);
            $.cookie("compass-syntax", mainSyntax, { expires: 60 * 60 * 24 * 365 * 10, path: '/' });
          }
          Severity: Major
          Found in compass-style.org/assets/javascripts/site.js and 3 other locations - About 1 hr to fix
          compass-style.org/assets/javascripts/site.js on lines 34..40
          compass-style.org/assets/javascripts/site.js on lines 56..59
          compass-style.org/assets/javascripts/site.js on lines 61..64

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

          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 4 locations. Consider refactoring.
          Open

          function setExampleStyleSyntaxPreference (exampleStyle) {
            $.cookie("compass-example-style", null);
            $.cookie("compass-example-style", exampleStyle, { expires: 60 * 60 * 24 * 365 * 10, path: '/' });
          }
          Severity: Major
          Found in compass-style.org/assets/javascripts/site.js and 3 other locations - About 1 hr to fix
          compass-style.org/assets/javascripts/site.js on lines 34..40
          compass-style.org/assets/javascripts/site.js on lines 51..54
          compass-style.org/assets/javascripts/site.js on lines 61..64

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

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

                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
                    Severity
                    Category
                    Status
                    Source
                    Language