opal/opal-browser

View on GitHub

Showing 71 of 87 total issues

Method arc has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

  def arc(x, y, radius, angle, clockwise = false)
Severity: Minor
Found in opal/browser/canvas.rb - About 35 mins to fix

    Method initialize has 5 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      def initialize(canvas, x, y, width, height)
    Severity: Minor
    Found in opal/browser/canvas/data.rb - About 35 mins to fix

      Method binary has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def binary
          return unless request.binary?
      
          if Buffer.supported?
            %x{
      Severity: Minor
      Found in opal/browser/http/response.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 >> has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def >>(node)
          if Opal.respond_to? node, :each
            node.each { |n| self >> n }
            return self
          elsif Opal.respond_to? node, :to_dom
      Severity: Minor
      Found in opal/browser/dom/node.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 animate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def animate(properties, duration: 0.4.s, easing: :ease, resolve: false, &block)
          animation_queue(resolve) do |res|
            duration = 0.6.s if duration == :slow
            duration = 0.2.s if duration == :fast
      
      
      Severity: Minor
      Found in opal/browser/effects.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def initialize(url, protocol = nil, &block)
          if native?(url)
            super(url)
          elsif protocol
            super(`new window.WebSocket(#{url.to_s}, #{protocol.to_n})`)
      Severity: Minor
      Found in opal/browser/socket.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 style has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def style(data = nil, &block)
          style = CSS::Declaration.new(`#@native.style`)
      
          return style unless data || block
      
      
      Severity: Minor
      Found in opal/browser/dom/element.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 shake has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

        def shake(dir)
          grid = @grid
          conversion = proc {}
          back_conversion = nil
      
      
      Severity: Minor
      Found in examples/2048/app/application.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 fade_out has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def fade_out(**kwargs, &block)
          animation_queue do |resolve|
            if visible?
              @virtually_visible = false
      
      
      Severity: Minor
      Found in opal/browser/effects.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(path, &block)
          if native?(path)
            super(path)
          else
            super(`new window.EventSource(path)`)
      Severity: Minor
      Found in opal/browser/event_source.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 add_field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def add_field
          return if lost? or won?
      
          y,x = nil
      
      
      Severity: Minor
      Found in examples/2048/app/application.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 def_custom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def def_custom(tag_name, base_class: nil, extends: nil)
              if `base_class !== nil`
              elsif self.superclass == Custom
                base_class = `HTMLElement`
              elsif self.ancestors.include? Custom
      Severity: Minor
      Found in opal/browser/dom/element/custom.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 slide_down has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def slide_down(**kwargs, &block)
          animation_queue do |resolve|
            if !visible?
              @virtually_visible = true
              show
      Severity: Minor
      Found in opal/browser/effects.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 callback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def callback
          -> event {
            state = STATES[`#@native.readyState`]
            res   = response
      
      
      Severity: Minor
      Found in opal/browser/http/request.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 * has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def *(other)
          return Unit.new(@number * other, @type) unless Unit === other
      
          if @type == other.type
            Unit.new(@number * other.to_f, @type)
      Severity: Minor
      Found in opal/browser/css/unit.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 [] has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def [](name, options = {})
          options = @options.merge(options)
      
          matches = `#@document.cookie`.scan(/#{Regexp.escape(FormData.encode(name))}=([^;]*)/)
      
      
      Severity: Minor
      Found in opal/browser/cookies.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 + has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def +(other)
          return Unit.new(@number + other, @type) unless Unit === other
      
          if @type == other.type
            Unit.new(@number + other.to_f, @type)
      Severity: Minor
      Found in opal/browser/css/unit.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 add_next_sibling has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def add_next_sibling(node = nil, &block)
          unless node
            node = DOM(&block)
          end
          node = node.to_dom(document) if Opal.respond_to? node, :to_dom
      Severity: Minor
      Found in opal/browser/dom/node.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 fade_in has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def fade_in(**kwargs, &block)
          animation_queue do |resolve|
            if !visible?
              @virtually_visible = true
              show
      Severity: Minor
      Found in opal/browser/effects.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 draw_image has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def draw_image(image, *args)
          if Canvas === image
            image = image.element
          else
            image = DOM(image)
      Severity: Minor
      Found in opal/browser/canvas.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