Showing 9 of 939 total issues
Function show
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
show: function() {
var title = this.getTitle();
if (title && this.enabled) {
var $tip = this.tip();
Method create
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def create
if params[:user]
user = User.new(users_params)
if user.save
if params['alarm']
- 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 jquery.tipsy.js
has 260 lines of code (exceeds 250 allowed). Consider refactoring. Open
// tipsy, facebook style tooltips for jquery
// version 1.0.0a
// (c) 2008-2010 jason frame [jason@onehackoranother.com]
// released under the MIT license
Function tipsy
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.tipsy = function(options) {
if (options === true) {
return this.data('tipsy');
} else if (typeof options == 'string') {
Method parse_json_value
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def parse_json_value(json_value, value, type)
if !json_value['features'].nil? && json_value['features'].count > 0
json_value['features'].each do |feature|
if type == "weather"
end_date = feature['attributes']['end_date']
- 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 garbageCollect
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
var garbageCollect = (function() {
var currentInterval;
var to = null;
var tipsies = [];
Method send_message
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def send_message(value)
UserAlarm.all.each do |user_alarm|
if (user_alarm.alarm_id.to_s == Alarm.find_by(name: value).id.to_s) && Message.find_by_user_id_and_alarm_id(user_alarm.user_id, user_alarm.alarm_id).nil?
user = User.find(user_alarm.user_id)
if user.email_actived
- 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 perform
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def perform(alert_id, message)
begin
UserAlarm.all.each do |user_alert|
if user_alert.alarm_id.to_s == alert_id.to_s
user = User.find(user_alert.user_id)
- 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
Avoid deeply nested control flow statements. Open
unless alarm.nil?
UserAlarm.create(user_id: user.id, alarm_id: alarm.id)
end