Showing 189 of 189 total issues
Class NotifierMailer
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class NotifierMailer < ApplicationMailer
add_template_helper(UsersHelper)
add_template_helper(ProtipsHelper)
add_template_helper(ApplicationHelper)
add_template_helper(AccountsHelper)
Class UsersController
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class UsersController < ApplicationController
after_action :track_referrer, only: :show
skip_before_action :require_registration, only: [:edit, :update]
layout 'coderwallv2', only: :edit
Class V1
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class V1 < Bitbucket
PROTOCOL = "https"
API_URL = "api.bitbucket.org/1.0"
WEB_URL = "bitbucket.org"
Class Skill
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class Skill < ActiveRecord::Base
never_wastes
SPACE = ' '
BLANK = ''
Class OpportunitiesController
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class OpportunitiesController < ApplicationController
before_action :lookup_team, only: [:activate, :deactivate, :new, :create, :edit, :update, :visit]
before_action :lookup_opportunity, only: [:edit, :update, :activate, :deactivate, :visit]
before_action :cleanup_params_to_prevent_tagging_error
before_action :validate_permissions, only: [:new, :edit, :create, :update, :activate, :deactivate]
Class Network
has 23 methods (exceeds 20 allowed). Consider refactoring. Open
class Network < ActiveRecord::Base
has_closure_tree order: :slug
acts_as_taggable
acts_as_followable
Method user_activity
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def user_activity(user, from, to, limit, publish=false)
activity_feed_keys = user.nil? ? Audience.to_key(Audience.all).to_a : user.subscribed_channels.map { |channel| Audience.channel_to_key(channel) }
count = 0
from = from.nil? ? "-inf" : from.to_f
- 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 users_controller.rb
has 265 lines of code (exceeds 250 allowed). Consider refactoring. Open
class UsersController < ApplicationController
after_action :track_referrer, only: :show
skip_before_action :require_registration, only: [:edit, :update]
layout 'coderwallv2', only: :edit
File application_controller.rb
has 264 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
protect_from_forgery
APP_DOMAIN = 'coderwall.com'
Class Audience
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
class Audience
def self.all
{ all: nil }
end
File teams_controller.rb
has 251 lines of code (exceeds 250 allowed). Consider refactoring. Open
class TeamsController < ApplicationController
skip_before_action :require_registration, :only => [:accept, :record_exit]
before_action :access_required, :except => [:index, :show, :new, :inquiry, :search, :create, :record_exit]
before_action :ensure_analytics_access, :only => [:visitors]
respond_to :js, :only => [:search, :create, :approve_join, :deny_join]
Method all
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.all
[
::Beaver,
::Beaver3,
Method edit
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def edit
respond_to do |format|
format.json do
settings
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 perform
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def perform(username, ip_address)
user = User.find_by_username(username)
unless user.nil? or user.ip_lat
geocoder = MaxMind.new
begin
- 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 update
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
def update
user_id = params[:id]
@user = user_id.blank? ? current_user : User.find(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
Method load_badges
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def load_badges
(2012..2020).each do |year|
Object.const_set "GithubGameoffJudge#{year}", Class.new(BadgeBase) {
describe "Github Gameoff Judge",
skill: 'game development',
Method aggregate_visitors
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def aggregate_visitors(since = 0)
aggregate = {}
visitors(since).map do |visitor|
user_id = visitor[:user_id].to_i
aggregate[user_id] ||= visitor
- 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 startGui
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
function startGui() {
inputPane = $('.x-tip-content.edit #protip_body')[0];
previewPane = $('.x-tip-content.preview #body')[0];
// if (typeof previewPane === "undefined")
Method save_with_payment
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def save_with_payment(plan=nil)
if stripe_card_token
create_customer unless plan.try(:one_time?)
subscribe_to!(plan) unless plan.nil?
save!
- 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 12 (exceeds 5 allowed). Consider refactoring. Open
def create
#FIXME
raise "OmniAuth returned error #{params[:error]}" unless params[:error].blank?
if signed_in?
current_user.apply_oauth(oauth)
- 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"