Showing 156 of 312 total issues
Method send_to_libui
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def send_to_libui(method_name, *args, &block)
if ::LibUI.respond_to?("#{libui_api_keyword}_#{method_name.to_s.sub(/\?$/, '')}") && args.empty?
property = method_name.to_s.sub(/\?$/, '')
value = ::LibUI.send("#{libui_api_keyword}_#{property}", libui, *args)
handle_string_property(property, handle_boolean_property(property, value))
- Read upRead up
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
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def draw(area_draw_params)
@start = ::LibUI.attributed_string_len(@parent_proxy.attributed_string)
::LibUI.attributed_string_append_unattributed(@parent_proxy.attributed_string, @string)
unless color.nil?
color_attribute = ::LibUI.new_color_attribute(@color[:r].to_f / 255.0, @color[:g].to_f / 255.0, @color[:b].to_f / 255.0, @color[:a] || 1.0)
- Read upRead up
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 custom_window_file
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def custom_window_file(custom_window_name, namespace, window_type, window_options = {})
window_options ||= {}
window_options[:custom_window_class_name] ||= 'CustomWindow'
namespace_type = class_name(namespace) == class_name(current_dir_name) ? 'class' : 'module'
- Read upRead up
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 boolean_to_integer
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def boolean_to_integer(bool, allow_nil: true, allow_integer: true)
bool.nil? ? (allow_nil ? nil : 0) : (allow_integer && bool.is_a?(Integer) ? bool : (bool.is_a?(TrueClass) || bool.is_a?(FalseClass) ? (bool == true ? 1 : 0) : (allow_nil ? nil : 0)))
end
- Read upRead up
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 interpret_color
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def interpret_color(value)
if value.is_a?(Array) && value.last.is_a?(Hash)
options = value.last
value = value[0...-1]
end
- Read upRead up
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 launch
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
def launch
window('Michael Ende (1929-1995) The Neverending Story', 600, 500) {
margined true
vertical_box {
Class Scaffold
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Scaffold
class << self
include FileUtils
VERSION = File.read(File.expand_path('../../../../VERSION', __FILE__)).strip
Class Tetromino
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class Tetromino
ORIENTATIONS = [:north, :east, :south, :west]
LETTER_COLORS = {
I: :cyan,
Method launch
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def launch
window('Contacts', 600, 600) {
margined true
vertical_box {
Method launch
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def launch
window('Contacts', 600, 600) {
margined true
vertical_box {
Method launch
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def launch
window('Contacts', 600, 600) {
margined true
vertical_box {
Method launch
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def launch
window('Contacts', 600, 600) {
margined true
vertical_box {
Method table_paginator
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def table_paginator
horizontal_box {
stretchy false
button('<<') {
- Read upRead up
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 time
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def time(value = nil)
@time ||= ::LibUI::FFI::TM.malloc
::LibUI.date_time_picker_time(@libui, @time)
if value.nil?
{
- Read upRead up
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 TextProxy
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class TextProxy < ControlProxy
include Parent
include PerfectShaped
prepend Transformable
Method integer_to_boolean
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def integer_to_boolean(int, allow_nil: true, allow_boolean: true)
int.nil? ? (allow_nil ? nil : false) : (allow_boolean && (int.is_a?(TrueClass) || int.is_a?(FalseClass)) ? int : (int.is_a?(Integer) ? int == 1 : (allow_nil ? nil : false)))
end
- Read upRead up
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 install_listeners
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def install_listeners
unless @listeners_installed
@area_handler.Draw = fiddle_closure_block_caller(0, [1, 1, 1]) do |_, _, area_draw_params|
area_draw_params = ::LibUI::FFI::AreaDrawParams.new(area_draw_params)
area_draw_params = area_draw_params_hash(area_draw_params)
Method custom_window_gem
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
def custom_window_gem(custom_window_name, namespace)
gem_name = "glimmer-libui-cw-#{custom_window_name.underscore}"
gem_summary = "#{human_name(custom_window_name)} - Glimmer Custom Window"
begin
custom_window_keyword = dsl_control_name(custom_window_name)
File tetromino.rb
has 271 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative 'block'
require 'matrix'
class Tetris
File shape.rb
has 267 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'glimmer/libui/parent'
require 'glimmer/libui/control_proxy/area_proxy'
require 'glimmer/libui/control_proxy/path_proxy'
require 'glimmer/libui/data_bindable'
require 'glimmer/libui/perfect_shaped'