Showing 172 of 172 total issues
Method generate_token
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def generate_token(opts = {})
{:session_id=>nil, :create_time=>nil, :expire_time=>nil, :role=>nil, :connection_data=>nil}.merge!(opts)
create_time = opts[:create_time].nil? ? Time.now : opts[:create_time]
session_id = opts[:session_id].nil? ? '' : opts[:session_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
Function Comment
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
SocialStream.Comment = (function(SS, $, undefined){
var callback = new SS.Callback();
var elAlwaysHidden = [
"input[type=submit]"
- 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 parseWord
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function parseWord(word){
//Look for empty or simple words
if ((word.trim()=="")||(word.match(simple_word_pattern)!=null)){
return word
Method updateSettings
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def updateSettings
success = false
#If no section selected, skips and gives error
- 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 index
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def index
@search_result =
if params[:q].blank? || params[:q].strip.size < SocialStream::Search::MIN_QUERY
Kaminari.paginate_array([])
elsif params[:mode] == "quick"
- 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 contact.js
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
// require jquery.ba-url
//
//= require social_stream/callback
SocialStream.Contact = (function($, SS, undefined) {
Function Timeline
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
SocialStream.Timeline = (function(SS, $, undefined){
var callback = new SS.Callback();
var initModalCarousel = function() {
var elements = $('.timeline [data-modal-carousel-id="false"]');
Function tiesGraph
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.tiesGraph = function( data ) {
//TODO: better handling of width and height
var w = 860,
h = 500,
fill = d3.scale.category20();
Method save_buddy
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def save_buddy
unless SocialStream::Presence.enable
return
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 create
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def create
super do |format|
format.json { render :json => resource.to_json(helper: self), status: :created }
format.js
format.all {
- 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 Wall
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
SocialStream.Documents.Wall = (function(SS, $, undefined) {
var initWall = function() {
$('<label/>', {
"for": 'new_document_title',
style: 'display: none;',
Method notification_subject
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def notification_subject
sender_name= sender.name.truncate(30, :separator => ' ')
receiver_name= receiver.name.truncate(30, :separator => ' ')
case verb
when 'like'
Function storeConversations
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
var storeConversations = function() {
var chatboxes = PRESENCE.WINDOW.getAllChatBoxes();
var pvisibleChatBoxes = PRESENCE.WINDOW.getVisibleChatBoxes();
var storedSlugs = [];
var storedGroupSlugs = [];
Function initWall
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
var initWall = function() {
$('<label/>', {
"for": 'new_document_title',
style: 'display: none;',
text: I18n.t('activerecord.attributes.document.title')
Method executeRemoteCommands
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def executeRemoteCommands(commands)
if commands.empty?
return "No command received";
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
Function createChatBox
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
var createChatBox = function(guest_slug,isGroup){
var guest_name = PRESENCE.XMPPClient.getNameFromSlug(guest_slug)
if(isGroup){
Function Wall
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
SocialStream.Wall = (function(SS, $, undefined){
var callback = new SS.Callback();
var initInputAutosize = function() {
Function Event
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
SocialStream.Event = (function(SS, $, undefined) {
var callback = new SS.Callback();
var color = function(){
return SS.Events.current.eventColor;
- 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 mailboxer_email
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def mailboxer_email(object)
#If actor has disabled the emails, return nil.
return nil if !notify_by_email
#If actor has enabled the emails and has email
return "#{name} <#{email}>" if email.present?
- 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 urlDetect
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
var urlDetect = function() {
this.currentValue = $("#post_text").val();
if (this.lastValue === null) {
this.lastValue = "";