chriseppstein/compass

View on GitHub

Showing 167 of 167 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 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

    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

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

        def compute_url(type, relative_path, relative_to_css_url = nil, use_cache_buster = true)
          # pass through fully specified urls
          return relative_path if relative_path.start_with?("http://")
      
          clean_relative_path, query, target = clean_path(relative_path)
      Severity: Minor
      Found in core/lib/compass/core/asset_url_resolver.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_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

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

              def mixins(item)
                sass_tree = tree(item)
                mixins = []
                comment = nil
                sass_tree.children.each do |child|
              Severity: Major
              Found in compass-style.org/lib/stylesheets.rb and 1 other location - About 1 hr to fix
              compass-style.org/lib/stylesheets.rb on lines 146..163

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

              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 functions(item)
                sass_tree = tree(item)
                functions = []
                comment = nil
                sass_tree.children.each do |child|
              Severity: Major
              Found in compass-style.org/lib/stylesheets.rb and 1 other location - About 1 hr to fix
              compass-style.org/lib/stylesheets.rb on lines 101..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 66.

              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 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 add_project_configuration has a Cognitive Complexity of 13 (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 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

              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/write_configuration.rb and 1 other location - About 1 hr to fix
              cli/lib/compass/commands/validate_project.rb on lines 39..70

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

              Severity
              Category
              Status
              Source
              Language