Showing 328 of 433 total issues
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 track_search_query
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def track_search_query
@query = params[:query_array]
# TODO: more hackery to make alternate formats still work with query_array
if /^(.*)\.json$/.match(@query)
- 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 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 prepare_environment
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def self.prepare_environment
return unless @@db_path.nil?
# barf if we can't figure out the environment
environment = (ENV['RAILS_ENV'] or Rails.env)
- 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 xapian_value
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def xapian_value(field, type = nil, index_translations = false)
if index_translations && respond_to?("translations")
if (type == :date) || (type == :boolean)
value = single_xapian_value(field, type = type)
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 move
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def move
editor = admin_current_user
if params[:commit] == 'Move request to user' && !params[:user_url_name].blank?
destination_user = User.find_by_url_name(params[:user_url_name])
- 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 load
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
that.load = function() {
var cardError = document.getElementById('card-errors');
// Sync initial state for terms checkbox and submit button
that.submit.setAttribute('disabled', 'true');
Method log_overdue_event_type
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.log_overdue_event_type(event_type)
date_field = case event_type
when 'overdue'
'date_response_required_by'
when 'very_overdue'
Method play
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def play
session[:request_game] = Time.zone.now
@missing = InfoRequest.
where_old_unclassified.
Method generate_upload_url
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def generate_upload_url
if params[:incoming_message_id]
incoming_message = IncomingMessage.find(params[:incoming_message_id])
email = incoming_message.from_email
name = incoming_message.safe_from_name || @info_request.public_body.name
Method create_batch
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_batch
@info_request_batch =
InfoRequestBatch.find(params[:info_request_batch_id])
authorize! :update, @info_request_batch
Method hidden_user_explanation
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def hidden_user_explanation
prominence_reason = render_to_string(
partial: "admin_request/hidden_user_explanation/#{params[:message]}",
formats: [:text],
locals: {
Method make_request_summary_file
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def make_request_summary_file(info_request)
done = false
@render_to_file = true
assign_variables_for_show_template(info_request)
if HTMLtoPDFConverter.exist?
Method load_file
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.load_file(file_name)
is_gz = file_name.include?(".gz")
file_name_db = is_gz ? file_name.gsub(".gz", "") : file_name
modified = File.stat(file_name).mtime
Method import_values_from_csv_row
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def import_values_from_csv_row(row, line, name, options)
is_new = new_record?
edit_info = if is_new
{ action: "creating new authority",
comment: 'Created from spreadsheet' }
Method phases
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.phases
[
{ capital_label: _('Awaiting response'),
label: _('awaiting response'),
scope: :awaiting_response,
Method lookup_query
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def lookup_query
@locale = AlaveteliLocalization.locale
AlaveteliLocalization.with_locale(@locale) do
@query = params[:query]
@query = nil if @query == ""