Showing 189 of 189 total issues
Class Team
has 128 methods (exceeds 20 allowed). Consider refactoring. Open
class Team < ActiveRecord::Base
DEFAULT_HEX_BRAND = '#343131'
FEATURED_TEAMS_CACHE_KEY = 'featured_teams_results'
MAX_TEAM_SCORE = 400
Class Protip
has 117 methods (exceeds 20 allowed). Consider refactoring. Open
class Protip < ActiveRecord::Base
extend FriendlyId
friendly_id :slug_format, :use => :slugged
include Featurable
File protip.rb
has 778 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'net_validators'
require 'open-uri'
require 'cfm'
require 'scoring'
require 'search'
File team.rb
has 600 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'search'
class Team < ActiveRecord::Base
DEFAULT_HEX_BRAND = '#343131'
FEATURED_TEAMS_CACHE_KEY = 'featured_teams_results'
Class ProtipsController
has 56 methods (exceeds 20 allowed). Consider refactoring. Open
class ProtipsController < ApplicationController
before_action :access_required, only: [:new, :create, :edit, :update, :destroy, :me]
before_action :require_skills_first, only: [:new, :create]
before_action :lookup_protip, only: %i(show edit update destroy upvote tag flag feature delete_tag)
Method expand
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
def self.expand(audience)
audience.keys.map(&:to_sym).collect do |target|
if target == :user_reach
user = User.find(audience[target])
- 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 protips_controller.rb
has 429 lines of code (exceeds 250 allowed). Consider refactoring. Open
class ProtipsController < ApplicationController
before_action :access_required, only: [:new, :create, :edit, :update, :destroy, :me]
before_action :require_skills_first, only: [:new, :create]
before_action :lookup_protip, only: %i(show edit update destroy upvote tag flag feature delete_tag)
Method social_bookmarks
has a Cognitive Complexity of 37 (exceeds 5 allowed). Consider refactoring. Open
def social_bookmarks(user)
bookmarks = []
bookmarks << social_bookmark('github', "https://github.com/" + user.github) unless user.github.blank?
if viewing_self?
bookmarks << social_bookmark('linkedin', linkedin_url(user)) unless user.linkedin_token.blank?
- 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
Class Opportunity
has 38 methods (exceeds 20 allowed). Consider refactoring. Open
class Opportunity < ActiveRecord::Base
include Tire::Model::Search
include Tire::Model::Callbacks
include SearchModule
include OpportunityMapping
Class ApplicationController
has 37 methods (exceeds 20 allowed). Consider refactoring. Open
class ApplicationController < ActionController::Base
protect_from_forgery
APP_DOMAIN = 'coderwall.com'
Method show
has a Cognitive Complexity of 28 (exceeds 5 allowed). Consider refactoring. Open
def show
#FIXME
show_params = params.permit(:job_id, :refresh, :callback, :id, :slug)
@team ||= team_from_params(slug: show_params[:slug], id: show_params[:id])
return render_404 unless @team
- 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 show
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def show
@user = User.find_by_username!(params[:username])
respond_to do |format|
format.html do
- 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 preprocess_query
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
def preprocess_query(query_string)
query = team = nil
unless query_string.nil?
query = query_string.dup
query.gsub!(/(\d+)\"/, "\\1\\\"") #handle 27" cases
- 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
Class User
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
class User < ActiveRecord::Base
include ActionController::Caching::Fragments
include NetValidators
include UserApi
include UserAward
Class TeamsController
has 27 methods (exceeds 20 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 popular_protips
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def popular_protips(user, protips, from, to)
fail 'User is required.' unless user
# Skip if this user has already been sent and email for this campaign id.
fail "Already sent email to #{user.id} please check Redis SET #{CAMPAIGN_ID}." unless REDIS.sadd(CAMPAIGN_ID, user.id.to_s)
- 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 record_event
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def record_event(action_name, options = {})
if !signed_in? || !current_user.admin?
options.merge!('mp_name_tag' => cookies[:identity]) unless cookies[:identity].blank?
options.merge!('distinct_id' => cookies[:trc]) unless cookies[:trc].blank?
unless current_user.nil?
- 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 search
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def search(query_string, tags =[], options={})
query, team, author, bookmarked_by, execution, sorts= preprocess_query(query_string)
tags = [] if tags.nil?
tags = preprocess_tags(tags)
tag_ids = process_tags_for_search(tags)
- 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 protips_helper.rb
has 289 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'cfm'
module ProtipsHelper
def protip_search_results_to_render(protips)
Method execute
has a Cognitive Complexity of 21 (exceeds 5 allowed). Consider refactoring. Open
def execute
query_criteria, filter_criteria, sort_criteria, facets, context = [@query, @scope, @sort, @facet, @context]
@context.tire.search(@options) do
query do
- 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"