Showing 338 of 434 total issues
Method on_rescue
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def on_rescue(node)
return unless node.body.multiline?
node.resbody_branches.each do |resbody|
next unless resbody.body && resbody.body.multiline?
- 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 single_xapian_value
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def single_xapian_value(field, type = nil)
value = send(field.to_sym) || self[field]
if type == :date
if value.is_a?(Time)
value.utc.strftime("%Y%m%d")
- 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 init_values
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.init_values(values)
values.each do |_method, index, prefix, value_type|
unless index.is_a? Integer
raise "Value index '#{index}' must be an Integer, is #{index.class}"
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 apply_pdf_masks
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def apply_pdf_masks(text, options = {})
uncompressed_text = uncompress_pdf(text)
# if we managed to uncompress the PDF...
if uncompressed_text.blank?
text
- 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 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
unless @user || params[:password_change_user]
@email_field_options = {}
render :new
return
Method permanently_failed_addresses
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.permanently_failed_addresses(message)
if MailHandler.empty_return_path?(message)
# Some sort of auto-response
# Check for Exim’s X-Failed-Recipients header
Method show
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show
long_cache
@display_user = set_display_user
set_view_instance_variables
@same_name_users = User.find_similar_named_users(@display_user)
Consider simplifying this complex logical expression. Open
if feature_enabled? :projects
can :read, Project do |target_project|
user && (user.is_pro_admin? || target_project.member?(user))
end
Method get_request_percentages
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.get_request_percentages(column, n, highest, minimum_requests)
total_column = "info_requests_visible_classified_count"
ordering = "y_value"
ordering += " DESC" if highest
y_value_column = "(cast(#{column} as float) / #{total_column})"
Function _update
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
RefusalWizard.prototype._update = function($current_question) {
var wizard = this;
var $next_question = wizard._nextQuestion();
if ($current_question) {
Method internal_admin_body
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.internal_admin_body
matching_pbs = AlaveteliLocalization.
with_locale(AlaveteliLocalization.default_locale) do
default_scoped.where(url_name: 'internal_admin_authority')
end
Method decode_attached_part
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def decode_attached_part(part, parent_mail)
if get_content_type(part) == 'message/rfc822'
# An email attached as text
part.rfc822_attachment = mail_from_raw_email(part.body)
if part.rfc822_attachment.nil?
Method authenticate
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def authenticate
if AlaveteliConfiguration.skip_admin_auth
session[:using_admin] = 1
nil
elsif session[:using_admin].nil? || session[:admin_name].nil?
Method receive
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def receive(email, raw_email_data, *args)
return if already_received?(email)
defaults = { override_stop_new_responses: false,
rejected_reason: nil,
Method highlight_matches
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def highlight_matches(text, phrases, options = {})
if options.fetch(:sanitize, true)
text = ActionController::Base.helpers.sanitize(text).try(:html_safe)
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 indexed_by_search?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def indexed_by_search?
if %w[sent followup_sent response comment].include?(event_type)
return false unless info_request.indexed_by_search?
if event_type == 'response' && !incoming_message.indexed_by_search?
return false
- 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 make_request_zip
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def make_request_zip(info_request, file_path)
Zip::File.open(file_path, create: true) do |zipfile|
file_info = make_request_summary_file(info_request)
zipfile.get_output_stream(file_info[:filename]) { |f| f.write(file_info[:data]) }
message_index = 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 create
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def create
unless @user || params[:password_change_user]
@email_field_options = {}
render :new
return
- 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 compare
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def compare(previous = nil)
if previous.nil?
changes = []
else
v = self
- 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 accept_incoming?
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def accept_incoming?(email, raw_email_data)
# See if new responses are prevented
gatekeeper = ResponseGatekeeper.for(allow_new_responses_from, self)
# Take action if the message looks like spam
spam_checker = ResponseGatekeeper::SpamChecker.new
- 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"