Showing 161 of 167 total issues
Method calculated_pos_kind
has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring. Open
def self.calculated_pos_kind(organization)
return organization.manual_pos_kind if organization.manual_pos_kind.present?
bikes = organization.created_bikes # NOTE: Only created, so regional orgs don't get them
recent_bikes = bikes.where(created_at: (Time.current - 1.week)..Time.current)
if organization.ascend_name.present? || recent_bikes.ascend_pos.count > 0
- 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 localizedDateText
has a Cognitive Complexity of 16 (exceeds 10 allowed). Consider refactoring. Open
localizedDateText (
time,
singleFormat,
preciseTime,
includeSeconds,
- 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 16 (exceeds 10 allowed). Consider refactoring. Open
def update
if !@impound_claim.submitting?
flash[:error] = if @impound_claim.responded?
"That claim has already been responded to"
else
- 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 16 (exceeds 10 allowed). Consider refactoring. Open
def update
if !@impound_claim.submitting?
flash[:error] = if @impound_claim.responded?
"That claim has already been responded to"
else
- 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 init
has 56 lines of code (exceeds 50 allowed). Consider refactoring. Open
init () {
this.initAdminSearchSelect()
this.initBikeTabs()
// Enable utilities
Method states
has 54 lines of code (exceeds 50 allowed). Consider refactoring. Open
def states
[
{name: "Alabama", abbr: "AL"},
{name: "Alaska", abbr: "AK"},
{name: "Arizona", abbr: "AZ"},
Method parse
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def self.parse(payload, sso_secret = nil)
sso = new
sso.sso_secret = sso_secret if sso_secret
parsed = Rack::Utils.parse_query(payload)
- 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_period
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def set_period
@timezone ||= Time.zone
# Set time period
@period ||= params[:period]
if @period == "custom"
- 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 matching_user_alerts
has a Cognitive Complexity of 15 (exceeds 10 allowed). Consider refactoring. Open
def matching_user_alerts
user_alerts = UserAlert
if UserAlert.kinds.include?(params[:search_kind])
@kind = params[:search_kind]
user_alerts = user_alerts.where(kind: @kind)
- 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 15 (exceeds 10 allowed). Consider refactoring. Open
def perform(bike_id)
bike = Bike.unscoped.where(id: bike_id).first
if bike.present?
bb_data = BikeBookIntegration.new.get_model(bike)
- 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 exports
has 51 lines of code (exceeds 50 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 set_location_info
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def set_location_info
if current_stolen_record.present?
# If there is a current stolen - even if it has a blank location - use it
# It's used for searching and displaying stolen bikes, we don't want other information leaking
self.attributes = if address_set_manually # Only set coordinates if the address is set manually
- 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 build_bike_status
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def build_bike_status
self.max_char = compute_max_char
location = ""
if !close_twitter_accounts&.first&.default? && neighborhood.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
Method available_graduated_notifications
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def available_graduated_notifications
return @available_graduated_notifications if defined?(@available_graduated_notifications)
if params[:search_status] == "all"
@search_status = "all"
a_graduated_notifications = graduated_notifications
- 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 available_stolen_records
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def available_stolen_records
return @available_stolen_records if defined?(@available_stolen_records)
@unapproved_only = !InputNormalizer.boolean(params[:search_unapproved])
@only_without_location = InputNormalizer.boolean(params[:search_without_location])
if @unapproved_only
- 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 ensure_user_allowed_to_edit
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def ensure_user_allowed_to_edit
@current_ownership = @bike.current_ownership
type = @bike&.type || "bike"
return true if @bike.authorize_and_claim_for_user(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"
Further reading
Method extracted_searchable_proximity_hash
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def extracted_searchable_proximity_hash(query_params, ip)
return false unless query_params[:stolenness] == "proximity"
location = query_params[:location]
return false unless location && !(location =~ /anywhere/i)
distance = query_params[:distance]&.to_i
- 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 matching_organizations
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def matching_organizations
return @matching_organizations if defined?(@matching_organizations)
@search_paid = InputNormalizer.boolean(params[:search_paid])
matching_organizations = Organization.unscoped.where(deleted_at: nil) # We don't want deleted orgs
matching_organizations = matching_organizations.paid if @search_paid
- 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_all
has a Cognitive Complexity of 14 (exceeds 10 allowed). Consider refactoring. Open
def load_all(kinds = nil, print_counts: false)
store_category_combos
kinds ||= %w[Color CycleType Manufacturer PropulsionType]
total_count = 0
- 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 14 (exceeds 10 allowed). Consider refactoring. Open
def show
@blog = Blog.friendly_find(params[:id])
unless @blog
raise ActionController::RoutingError.new("Not Found")
- 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"