Showing 17 of 62 total issues
Function exports
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
Method action_statement
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def action_statement(notifiable)
case notifiable.class.name
when 'Post'
if notifiable.reposting
"Reposted
- 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 _on
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
_on: function( suppressDisabledCheck, element, handlers ) {
var delegateElement;
var instance = this;
// No suppressDisabledCheck flag, shuffle arguments
Function top
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
top: function( position, data ) {
var within = data.within,
withinOffset = within.offset.top + within.scrollTop,
outerHeight = within.height,
offsetTop = within.isWindow ? within.scrollTop : within.offset.top,
Function left
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
left: function( position, data ) {
var within = data.within,
withinOffset = within.offset.left + within.scrollLeft,
outerWidth = within.width,
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
Function _createWidget
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_createWidget: function( options, element ) {
element = $( element || this.defaultElement || this )[ 0 ];
this.element = $( element );
this.uuid = widgetUuid++;
this.eventNamespace = "." + this.widgetName + this.uuid;
Function option
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
option: function( key, value ) {
var options = key;
var parts;
var curOption;
var i;
Method create
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@post = current_user.posts.build
@repost = @post.build_repost(user: current_user, reposted: @reposting)
respond_to do |format|
if @post.save
Method create
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
@comment = @commentable.comments.build(comment_params)
@comment.created_by = current_user
respond_to do |format|
Function top
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
top: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollTop : within.offset.top,
outerHeight = data.within.height,
collisionPosTop = position.top - data.collisionPosition.marginTop,
Function left
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
left: function( position, data ) {
var within = data.within,
withinOffset = within.isWindow ? within.scrollLeft : within.offset.left,
outerWidth = within.width,
collisionPosLeft = position.left - data.collisionPosition.marginLeft,
Function connect
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
connect() {
function debounce(func, wait = 10, immediate = true) {
let timeout
return function() {
let context = this, args = arguments
Function _initSource
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
_initSource: function() {
var array, url,
that = this;
if ( Array.isArray( this.options.source ) ) {
array = this.options.source;
Method create
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
user = User.search_by(params[:search]).first unless params[:search].blank?
@direct =
if user
current_user.find_or_init_direct_message(user, direct_params)
Method create
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create
user = User.search_by(params[:search]).first unless params[:search].blank?
@direct =
if user
current_user.find_or_init_direct_message(user, direct_params)
- 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 set_objects
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def set_objects
if user_signed_in? && @from_controller == "sites" && @from_action == "index"
sites_objects
elsif @from_controller == "users" && @from_action == "show"
users_objects
- 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 read_user_notifications
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def read_user_notifications(current_user)
if self.class.name == "Direct"
read_message_notifications(current_user)
else
self.notifications.by_unread.where(recipient: current_user).
- 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"