Showing 13 of 26 total issues
Method notify_all
has a Cognitive Complexity of 23 (exceeds 5 allowed). Consider refactoring. Open
def notify_all
users.fetch.each do |login|
next unless telechats.wired?(login)
chat = telechats.chat_of(login)
fresh = telepings.fresh(login)
- 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 query
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def query(id, query)
where = []
words = []
unless id.positive?
query.strip.downcase.split.each do |w|
- 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 query
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
def query(id, query)
where = []
words = []
unless id.positive?
query.strip.downcase.split.each do |w|
File 0rsk.rb
has 252 lines of code (exceeds 250 allowed). Consider refactoring. Open
$stdout.sync = true
require 'glogin'
require 'glogin/codec'
require 'haml'
Method reply
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def reply(msg, login)
case msg
when %r{^/done$}
left = tasks(login: login).fetch(limit: 100)
if left.empty?
Method task_list
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def task_list(list)
if list.count < 8
[
'Here is a full list of them:',
list.map do |t|
- 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
Function auto
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function auto(kind, uri) {
"use strict";
var $input = $("#" + kind);
$input.on("input", function() {
$("#" + kind + "_detach").addClass("red");
Method query
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def query(query)
Rsk::Query.new(
@pgsql,
[
'SELECT * FROM (SELECT DISTINCT ON (task.id) task.id, task.plan,',
Method reply
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def reply(msg, login)
case msg
when %r{^/done$}
left = tasks(login: login).fetch(limit: 100)
if left.empty?
- 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 task_list
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def task_list(list)
if list.count < 8
[
'Here is a full list of them:',
list.map do |t|
Method notify_all
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def notify_all
users.fetch.each do |login|
next unless telechats.wired?(login)
chat = telechats.chat_of(login)
fresh = telepings.fresh(login)
Method delete
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def delete(id)
@pgsql.transaction do |t|
triple = fetch(id: id.to_i)[0]
raise Rsk::Urror, "Triple ##{id} not found in your project ##{@project}" if triple.nil?
if t.exec('SELECT * FROM part WHERE id = $1 AND project = $2', [triple[:cid], @project]).empty?
- 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 process_request
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def process_request(chat, message)
login = telechats.login_of(chat)
response = begin
reply(message.text, login)
rescue StandardError => e
- 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"