under-os/under-os

View on GitHub

Showing 32 of 32 total issues

File awesome.rb has 373 lines of code (exceeds 250 allowed). Consider refactoring.
Open

class UnderOs::UI::IconEngineAwesome
  NAMES_MAP = {
    'glass' => 0xF000,
    'music' => 0xF001,
    'search' => 0xF002,
Severity: Minor
Found in gems/under-os-ui/lib/under_os/ui/icon/awesome.rb - About 4 hrs to fix

    Method values has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring.
    Open

      def values
        {}.tap do |values|
          inputs.each do |input|
            next if input.disabled || ! input.name || (input.is_a?(UnderOs::UI::Switch) && !input.checked)
    
    
    Severity: Minor
    Found in gems/under-os-ui/lib/under_os/ui/form.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

    Class Style has 27 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class Style
        module Margins
          def display
            @display || :block
          end
    Severity: Minor
    Found in gems/under-os-ui/lib/under_os/ui/style/margins.rb - About 3 hrs to fix

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

        class Style
          module Positioning
            def width
              @view.frame.size.width
            end
      Severity: Minor
      Found in gems/under-os-ui/lib/under_os/ui/style/positioning.rb - About 3 hrs to fix

        Method parse_shadow_params has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
        Open

              def parse_shadow_params(string)
                x, y, radius, opacity, color = string.strip.split
        
                x = x.gsub /px$/, ''
                y = y.gsub /px$/, ''
        Severity: Minor
        Found in gems/under-os-ui/lib/under_os/ui/style/outlining.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

        Class Style has 23 methods (exceeds 20 allowed). Consider refactoring.
        Open

          class Style
            module Outlining
              def opacity
                @view.alpha
              end
        Severity: Minor
        Found in gems/under-os-ui/lib/under_os/ui/style/outlining.rb - About 2 hrs to fix

          Class Input has 22 methods (exceeds 20 allowed). Consider refactoring.
          Open

          class UnderOs::UI::Input < UnderOs::UI::View
            class TextFieldWithPaddings < UITextField
              attr_accessor :wrapper
          
              def textRectForBounds(bounds)
          Severity: Minor
          Found in gems/under-os-ui/lib/under_os/ui/input.rb - About 2 hrs to fix

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

                  def setup(*args, &block)
                    config.setup_blocks << proc do |app|
                      UnderOs.setup_callbacks.each do |__file__, block|
                        Dir.glob(File.dirname(__file__) + '/**/*.rb').sort.each do |file|
                          position = app.files.index {|i| i.slice(0, 2) == "./" }
            Severity: Minor
            Found in gems/under-os-core/lib/under-os-core.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 included has 52 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              def self.included(base)
                base.instance_eval do
                  attr_accessor :_
            
                  def self.wraps(raw_class, options={})
            Severity: Major
            Found in gems/under-os-ui/lib/under_os/ui/utils/wrap.rb - About 2 hrs to fix

              Method attrs_score_for has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
              Open

                def attrs_score_for(view)
                  score = 0; return 0 if @rule[:attrs].size == 0
              
                  @rule[:attrs].each do |key, value, operand|
                    attr = view.respond_to?(key) && view.__send__(key)
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/page/matcher.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 close_tag has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
              Open

                def close_tag
                  if m = @chunk.match(/\A<\/([a-z]+)>/)
                    while node = @stack.pop
                      if node[:tag] != m[1]
                        if @stack.size > 0
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/parser/html.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 new has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                    def self.new(options={}, *args, &block)
                      return INSTANCES_CACHE[options] if INSTANCES_CACHE[options]
              
                      if options.is_a?(UIView)
                        klass = find_wrap_for(options.class)
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/ui/utils/wrap.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 select_optgroups_from has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def select_optgroups_from(nodes)
                  nodes = [{tag: 'optgroup', children: nodes}] if nodes[0][:tag] == 'option'
              
                  nodes.map do |group|
                    {}.tap do |options|
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/page/builder.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 parse has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
              Open

                def parse(string)
                  {}.tap do |rule|
                    if m = string.match(/^([a-z\*]+)/)
                      rule[:tag] = m[1].upcase
                    else
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/page/matcher.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 score_for has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
              Open

                def score_for(view)
                  return summary_score_for(view) if @multiple_matchers
              
                  id_score    = id_score_for(view)
                  tag_score   = tag_score_for(view)
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/page/matcher.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 parent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def parent(css_rule=nil)
                  if ! css_rule
                    UnderOs::UI::View.new(@_.superview) if @_.superview
                  else
                    parent = self
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/ui/utils/traversing.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 parse_attrs_in has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
              Open

                def parse_attrs_in(string)
                  merge_data_attrs({}.tap do |hash|
                    string.scan(/([a-z][a-z_\-\d]+)=('|")(.+?)(\2)/).each do |match|
                      value = match[0] == match[2] ? true : match[2]
                      value = true  if value == 'true'
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/parser/html.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 ui_color_from has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                  def ui_color_from(*args)
                    origin = args.size == 1 ? args[0] : args
              
                    if    origin.is_a?(UIColor) then origin
                    elsif origin.is_a?(Array)   then color_from_array(*origin)
              Severity: Minor
              Found in gems/under-os-core/lib/under_os/color.rb - About 55 mins 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 initialize has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def initialize(options={})
                  super
              
                  @_.wrapper = self if @_.respond_to?(:wrapper=)
              
              
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/ui/input.rb - About 55 mins 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 stylesheets has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
              Open

                def self.stylesheets
                  ($stylesheets ||= []).tap do |files|
                    files << "under-os.css"    unless files.include?("under-os.css")
                    files << "application.css" unless files.include?("application.css")
                  end
              Severity: Minor
              Found in gems/under-os-ui/lib/under_os/app.rb - About 55 mins 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