100% free for Open Source, forever. Get another set of eyes on your code.

  • Very high overall complexity (complexity = 546)

    Found in Slim::Parser
  • Very complex method #parse_tag (complexity = 100)

        def parse_tag(tag)
          if @tag_shortcut[tag]
            @line.slice!(0, tag.size) unless @attr_shortcut[tag]
            tag = @tag_shortcut[tag]
          end
    
    View more
    Found in Slim::Parser
  • Very complex method #initialize (complexity = 92)

        def initialize(opts = {})
          super
          @attr_list_delims = options[:attr_list_delims]
          @code_attr_delims = options[:code_attr_delims]
          tabsize = options[:tabsize]
    
    View more
    Found in Slim::Parser
  • Very complex method #parse_line_indicators (complexity = 89)

        def parse_line_indicators
          case @line
          when /\A\/!( ?)/
            # HTML comment
            @stacks.last << [:html, :comment, [:slim, :text, :verbatim, parse_text_block($', @indents.last + $1.size + 2)]]
    
    View more
    Found in Slim::Parser
  • Very complex method #process (complexity = 65)

        def process
          args = @args.dup
          unless @options[:input]
            file = args.shift
            if file
    
    View more
    Found in Slim::Command
  • Complex method #set_opts (complexity = 55)

        def set_opts(opts)
          opts.on('-s', '--stdin', 'Read input from standard input instead of an input file') do
            @options[:input] = $stdin
          end
    
    
    View more
    Found in Slim::Command
  • Complex method #make_builder (complexity = 53)

          def make_builder(attrs)
            @splat_options ||= unique_name
            builder = unique_name
            result = [:multi, [:code, "#{builder} = ::Slim::Splat::Builder.new(#{@splat_options})"]]
            attrs.each do |attr|
    
    View more
  • Complex method #init_compiled_benches (complexity = 47)

      def init_compiled_benches
        haml_pretty = Haml::Engine.new(@haml_code, format: :html5, escape_attrs: false)
        haml_ugly   = Haml::Engine.new(@haml_code, format: :html5, ugly: true, escape_attrs: false)
    
        context  = Context.new
    
    View more
  • Complex method #parse_attributes (complexity = 47)

        def parse_attributes(attributes)
          # Check to see if there is a delimiter right after the tag name
          delimiter = nil
          if @line =~ @attr_list_delims_re
            delimiter = @attr_list_delims[$1]
    
    View more
    Found in Slim::Parser
  • Complex method #init_parsing_benches (complexity = 40)

      def init_parsing_benches
        context  = Context.new
        context_binding = context.instance_eval { binding }
    
        bench(:parsing, 'erb')         { ERB.new(@erb_code).result(context_binding) }
    
    View more
  • Complex method #parse_text_block (complexity = 40)

        def parse_text_block(first_line = nil, text_indent = nil)
          result = [:multi]
          if !first_line || first_line.empty?
            text_indent = nil
          else
    
    View more
    Found in Slim::Parser
  • Complex method #parse_ruby_code (complexity = 38)

        def parse_ruby_code(outer_delimiter)
          code, count, delimiter, close_delimiter = '', 0, nil, nil
    
          # Attribute ends with space or attribute delimiter
          end_re = /\A[\s#{Regexp.escape outer_delimiter.to_s}]/
    
    View more
    Found in Slim::Parser
  • Complex method #lambda (complexity = 33)

            def lambda(name, &block)
              @lookup.each do |lookup|
                case lookup
                when :method
                  return @dict.send(name, &block) if @dict.respond_to?(name)
    
    View more
  • Complex method #parse_line (complexity = 32)

        def parse_line
          if @line =~ /\A\s*\Z/
            @stacks.last << [:newline]
            return
          end
    
    View more
    Found in Slim::Parser
  • Complex method #register (complexity = 31)

          def register(name, klass, *option_filter)
            name = name.to_sym
            local_options = option_filter.last.respond_to?(:to_hash) ? option_filter.pop.to_hash : {}
            define_options(name, *option_filter)
            klass.define_options(name)
    
    View more
  • Complex method #splat? (complexity = 31)

          def splat?(attr)
            # Splat attribute given
            attr[0] == :slim && attr[1] == :splat ||
              # Hyphenated attribute also needs splat handling
              (attr[0] == :html && attr[1] == :attr && options[:hyphen_attrs].include?(attr[2]) &&
    
    View more
  • Complex code in Slim::Engine definition outside of methods (complexity = 31)

    Found in Slim::Engine
  • Complex method #init_tilt_benches (complexity = 31)

      def init_tilt_benches
        tilt_erb         = Tilt::ERBTemplate.new { @erb_code }
        tilt_erubis      = Tilt::ErubisTemplate.new { @erb_code }
        tilt_temple_erb  = Temple::ERB::Template.new { @erb_code }
        tilt_haml_pretty = Tilt::HamlTemplate.new(format: :html5) { @haml_code }
    
    View more
  • Complex method #on_html_tag (complexity = 29)

        def on_html_tag(tag, attributes, content = nil)
          return super if tag != 'include'
          name = content.to_a.flatten.select {|s| String === s }.join
          raise ArgumentError, 'Invalid include statement' unless attributes == [:html, :attrs] && !name.empty?
          unless file = find_file(name)
    
    View more
    Found in Slim::Include
  • Complex code in Slim::Embedded definition outside of methods (complexity = 29)

  • Complex method #unknown_line_indicator (complexity = 27)

          def unknown_line_indicator
            if @line =~ /\A>( ?)/
              # Found explicit text block.
              @stacks.last << [:slim, :text, :explicit, parse_text_block($', @indents.last + $1.size + 1)]
            else
    
    View more
  • Complex method #on_multi (complexity = 26)

        def on_multi(*exps)
          result = [:multi]
          # This variable is true if the previous line was
          # (1) a control code and (2) contained indented content.
          prev_indent = false
    
    View more
  • Previous Page
    Next Page