Compass/compass

View on GitHub

Showing 134 of 168 total issues

Method to_sass_plugin_options has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

      def to_sass_plugin_options
        locations = []
        locations << [sass_path, css_path] if sass_path && css_path
        Compass::Frameworks::ALL.each do |framework|
          locations << [framework.stylesheets_directory, File.join(css_path || css_dir || ".", framework.name)]
Severity: Minor
Found in core/lib/compass/configuration/adapters.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

Function Brush has 52 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/shBrushCss.js - About 2 hrs to fix

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

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

      Method with_each_font_file has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
      Open

        def with_each_font_file(*args)
          skip_next = false
      
          args.each_with_index do |path, index|
            assert_type path, :String
      Severity: Minor
      Found in core/lib/compass/core/sass_extensions/functions/font_files.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 inherited_array has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              def inherited_array(*attributes)
                options = attributes.last.is_a?(Hash) ? attributes.pop : {}
                inherited_reader(*attributes)
                inherited_writer(*attributes)
                attributes.each do |attr|
      Severity: Minor
      Found in core/lib/compass/configuration/inheritance.rb - About 1 hr to fix

        Method set_project_options has 44 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def set_project_options(opts)
            opts.on('-c', '--config CONFIG_FILE', 'Specify the location of the configuration file explicitly.') do |configuration_file|
              self.options[:configuration_file] = configuration_file
            end
        
        
        Severity: Minor
        Found in cli/lib/compass/exec/project_options_parser.rb - About 1 hr to fix

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

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

                  def visit_depth_first(visitor)
                    visitor.visit(self)
                    visitor.down(self) if children.any? and visitor.respond_to?(:down)
                    if is_a?(ImportNode) && visitor.import?(self)
                      root = Sass::Engine.for_file(import, @options).to_tree
          Severity: Minor
          Found in core/lib/compass/core/sass_extensions/monkey_patches/traversal.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_position has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

              def grad_position(color_list, index, default, radial = bool(false))
                assert_type color_list, :List
                stop = color_list.value[index.value - 1].stop
                if stop && radial.to_bool
                  orig_stop = stop
          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 add_project_configuration has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
          Open

                def add_project_configuration(*args)
                  options = args.last.is_a?(Hash) ? args.pop : {}
                  configuration_file_path = args.shift || detect_configuration_file
          
                  raise ArgumentError, "Too many arguments" if args.any?
          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 add_sass_configuration has 42 lines of code (exceeds 25 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 1 hr to fix

            Method set_global_options has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def set_global_options(opts)
                opts.on('-r LIBRARY', '--require LIBRARY',
                        "Require the given ruby LIBRARY before running commands.",
                        "  This is used to access compass plugins without having a",
                        "  project configuration file."
            Severity: Minor
            Found in cli/lib/compass/exec/global_options_parser.rb - About 1 hr to fix

              Method image_url has 40 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def image_url(path, only_path = bool(false), cache_buster = bool(true))
                    path = path.value # get to the string value of the literal.
              
                    if path =~ %r{^#{Regexp.escape(Compass.configuration.http_images_path)}/(.*)}
                      # Treat root relative urls (without a protocol) like normal if they start with
              Severity: Minor
              Found in core/lib/compass/core/sass_extensions/functions/urls.rb - About 1 hr to fix

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

                    def examine(io)
                      class << io
                        unless method_defined?(:readbyte)
                          def readbyte
                            getc
                Severity: Minor
                Found in core/lib/compass/core/sass_extensions/functions/image_size.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 omitted_usage has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                  def omitted_usage(browser, min_version, max_version = nil)
                    versions = versions(browser)
                    min_version = caniuse_version(browser, min_version)
                    max_version = caniuse_version(browser, max_version)
                    if max_version.nil?
                Severity: Minor
                Found in core/lib/compass/core/caniuse.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 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

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

                  def md5sum(file, format = nil)
                    assert_type file, :String
                    filename = nil
                    if options[:css_filename] && File.exists?(options[:css_filename])
                      filename = File.expand_path(file.value, File.dirname(options[:css_filename]))
                Severity: Minor
                Found in core/lib/compass/core/sass_extensions/functions/files.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 write_file has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
                Open

                    def write_file(file_name, contents, options = nil, binary = false)
                      options ||= self.options if self.respond_to?(:options)
                      skip_write = false
                      contents = process_erb(contents, options[:erb]) if options[:erb]
                      if File.exists?(file_name)
                Severity: Minor
                Found in cli/lib/compass/actions.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 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 generated_image_url has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                      def generated_image_url(path, cache_buster = bool(false))
                        path = path.value # get to the string value of the literal.
                  
                        if path =~ %r{^#{Regexp.escape(Compass.configuration.http_generated_images_path)}/(.*)}
                          # Treat root relative urls (without a protocol) like normal if they start with
                  Severity: Minor
                  Found in core/lib/compass/core/sass_extensions/functions/urls.rb - About 1 hr to fix
                    Severity
                    Category
                    Status
                    Source
                    Language