3scale/porta

View on GitHub

Showing 312 of 5,567 total issues

Method fields_to_xml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def fields_to_xml(xml)
defined_builtin_fields.each do |field|
next if field_value(field.name).blank?
value = field_value(field.name)
 
 
Severity: Minor
Found in app/lib/fields/fields.rb - About 25 mins to fix

Method up has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def self.up
model = ApiDocs::Service
 
add_column :api_docs_services, :base_path, :string
docs = model.connection.select_all "SELECT id, body FROM api_docs_services"
Severity: Minor
Found in db/migrate/20120511140727_add_base_path_to_api_docs_service.rb - About 25 mins to fix

Method join_scopes has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def join_scopes(selected_scopes)
# process default scopes - reduce all default scopes to one
scope = default_search_scopes.inject(default_search_scope) do |scope, (method, args)|
# skip default scope if it is used explicitly in params
next scope if selected_scopes.include?(method.to_s)
Severity: Minor
Found in app/lib/three_scale/search.rb - About 25 mins to fix

Method api_behavior has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def api_behavior
resource = serializable
resource = representer.prepare(resource) unless resource.frozen?
 
case
Severity: Minor
Found in app/lib/three_scale/api/responder.rb - About 25 mins to fix

Method top_users has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def top_users
return unless @hit_metric
 
options = {:metric => @hit_metric, :period => @period, :timezone => @account.timezone,
:since => 1.send(@period).ago, :limit => 5}
Severity: Minor
Found in app/lib/pdf/data.rb - About 25 mins to fix

Method assign_to_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def assign_to_message(message)
message.subject = @subject if @subject
 
message.headers['bcc'] = @bcc if @bcc
message.headers['cc'] = @cc if @cc
Severity: Minor
Found in lib/developer_portal/lib/liquid/tags/email.rb - About 25 mins to fix

Method create has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def create
find_user_by_activation_code or return
 
if @user.activate
flash_key = @user.account.approval_required? ? 'approval_required' : 'complete'

Method assign_to_mail has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def assign_to_mail(mail)
mail[:subject] = @subject if @subject
mail[:bcc] = @bcc if @bcc
mail[:cc] = @cc if @cc
mail[:from] = @from if @from
Severity: Minor
Found in lib/developer_portal/lib/liquid/tags/email.rb - About 25 mins to fix

Method help has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def help(assigns)
assigns = Hash[
assigns.map do |name, value|
klass = value.class
klass_name = if klass.respond_to?(:name)
Severity: Minor
Found in lib/developer_portal/lib/liquid/tags/debug.rb - About 25 mins to fix

Method signup_notification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def signup_notification(user)
provider = self.provider_account = user.account.provider_account
 
subject = user.account.provider? ? "3scale account confirmation" : "#{account_name(user)} API account confirmation"
 
 
Severity: Minor
Found in lib/developer_portal/app/mailers/user_mailer.rb - About 25 mins to fix

Method debug_callback has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def debug_callback(callback)
->(target, *args, &block) do
begin
result = callback.call(target, *args, &block)
rescue => e
Severity: Minor
Found in config/initializers/debug_callbacks.rb - About 25 mins to fix

Method debug_message has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

def debug_message(target, result)
return if chain_config[:terminator].blank?
conditions = []
 
conditions.push "if: #{Array.wrap(@if).join(' && ')}" if @if.present?
Severity: Minor
Found in config/initializers/debug_callbacks.rb - About 25 mins to fix
Severity
Category
Status
Source
Language