under-os/under-os

View on GitHub

Showing 28 of 32 total issues

Method to_navigation_item has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def to_navigation_item(view)
    view = to_raw_uiview(view)

    if view.is_a?(UIBarButtonItem)
      view
Severity: Minor
Found in gems/under-os-ui/lib/under_os/ui/navbar.rb - About 45 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 parse has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

  def parse(html)
    html = html.strip.gsub(/<\!--[\s\S]*?-->/, '').gsub(/>\s+/, '>').gsub(/\s+</, '<')

    [].tap do |top|
      @top   = top
Severity: Minor
Found in gems/under-os-ui/lib/under_os/parser/html.rb - About 45 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 build_layout_from_html has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

  def build_layout_from_html
    if filename = find_layout_with_type('html')
      if layout = UnderOs::Parser.parse(filename)
        if view = UnderOs::Page::Builder.views_from(layout)[0]
          @page._.view = view._
Severity: Minor
Found in gems/under-os-ui/lib/under_os/page/layout.rb - About 35 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 param_2_rgb has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def param_2_rgb(a) # 0.0..1.0
      x = 1 / 6.0
      s = a % x / x
      r = 1 - s

Severity: Minor
Found in gems/under-os-core/lib/under_os/color.rb - About 25 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 load has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def load(url, options={}, &complete)
    UnderOs::HTTP.get(url, options) do |response|
      self.src = response.data
      complete.call(response) if complete && complete.arity != 0
      complete.call           if complete && complete.arity == 0
Severity: Minor
Found in gems/under-os-ui/lib/under_os/ui/image.rb - About 25 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 6 (exceeds 5 allowed). Consider refactoring.
Open

  def initialize(x, y=nil)
    if x.is_a?(UnderOs::Point)
      y = x.y if x.y
      x = x.x
    elsif x.is_a?(Hash)
Severity: Minor
Found in gems/under-os-core/lib/under_os/point.rb - About 25 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 contentWidth= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def contentWidth=(value)
        return unless @view.is_a?(UIScrollView)

        if value == 'auto'
          value = 0
Severity: Minor
Found in gems/under-os-ui/lib/under_os/ui/style/positioning.rb - About 25 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 contentHeight= has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def contentHeight=(value)
        return unless @view.is_a?(UIScrollView)

        if value == 'auto'
          value = 0
Severity: Minor
Found in gems/under-os-ui/lib/under_os/ui/style/positioning.rb - About 25 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