Showing 263 of 263 total issues
Method feed_update
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def feed_update(win,st,url)
return unless url && url.size>0
#win.set_title(url.gsub(/https?:\/\//,""))
gui_invoke { gui_invoke { win.clear(st) } }
rss = SimpleRSS.parse open(url)
- 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
File benchi.rb
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
require_relative '../lib/Ruiby'
require 'timeout'
$global=binding
class Test ; def self.test() 1 end ; end
Method get_update
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def get_update(app)
return if Thread.list.size>2
Thread.new {
now=Time.now
if $first || $fr_ouverture.member?(Time.now.hour)
- 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 component
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
def component()
stack do
a=slot(Image.new( :stock => Gtk::Stock::OPEN, :size => :button))
sloti(htoolbar do
toolbar_button("open","ouvrir fichier") {
Identical blocks of code found in 2 locations. Consider refactoring. Open
module Tools
CROSSGAP=8
def draw_tile(ctx,f,x,y,pdx,pdy)
ctx.set_source_pixbuf(get_pixbuf(f),(x-pdx)*256,(y-pdy)*256)
ctx.paint
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 136.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Identical blocks of code found in 2 locations. Consider refactoring. Open
module Tools
CROSSGAP=8
def draw_tile(ctx,f,x,y,pdx,pdy)
ctx.set_source_pixbuf(get_pixbuf(f),(x-pdx)*256,(y-pdy)*256)
ctx.paint
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 136.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Method component
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def component()
stack do
htoolbar_with_icon_text do
button_icon_text "open","Open file..." do
load(ask_file_to_read(".","*.rb"),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
Method track
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def plot.track(event)
return unless @config[:tracker]
x=nil
lt=@curves.each_with_object([]) {|(name,d),a|
next unless d[:type]==:curve
- 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 component
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
def component()
stack do
#------------ title + entry
stacki do
flow do
Method expose
has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring. Open
def plot.expose(w,ctx)
return unless @curves
w.draw_rectangle(0,0,@config[:w],@config[:h],0,nil,@config[:bg],0) if @config[:bg]
if @config[:grid]
dx=dy=(@config[:grid]||"40").to_i
- 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
File layouts.rb
has 308 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Ruiby_dsl
############################ Slot : H/V Box or Frame
# container : vertical box, take all space available, sloted in parent by default
Method run_window
has 83 lines of code (exceeds 25 allowed). Consider refactoring. Open
def run_window()
Ruiby.app width: $W, height: $H, title: "Curve" do
fn=Ruiby::MEDIA+"/famfamfam/chart_curve.png"
set_icon(fn) if File.exists?(fn)
set_resizable(true)
Method component
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
def component()
stack do
################## Menu
menu_bar do
menu("File") {
Method component
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def component()
stack do
htoolbar do
toolbar_button("open","ouvrir fichier") {
load(ask_file_to_read(".","*.rb"))
- 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 dialog_icones
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def dialog_icones
dialog "Ruiby Predefined icones" do
stack do
scrolled(400,500) {
Gtk::IconTheme.default.icons.sort.map { |name|
- 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
File form_fields.rb
has 293 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Ruiby_dsl
############### Inputs widgets
# combo box.
# Choices are describes with:
Class VElem
has 26 methods (exceeds 20 allowed). Consider refactoring. Open
class VElem
def initialize() @lpoints=[];@style={} end
def bbox()
@lpoints.inject(Bbox.new){ |bb,p| bb << [p[0],p[1]] }
end
Method list
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
def list(title,w=0,h=0,options={})
scrolled_win = Gtk::ScrolledWindow.new
scrolled_win.set_policy(:automatic ,:automatic )
scrolled_win.set_width_request(w) if w>0
scrolled_win.set_height_request(h) if h>0
Method tree_grid
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
def tree_grid(names,w=0,h=0,options={})
scrolled_win = Gtk::ScrolledWindow.new
scrolled_win.set_policy(:automatic,:automatic)
scrolled_win.set_width_request(w) if w>0
scrolled_win.set_height_request(h) if h>0
Method initialize
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def initialize(title,w,h)
super()
$app=self unless defined?($app)
init_threader()
#threader(10) # must be call by user window, if necessary
- 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"