Showing 947 of 1,181 total issues
Method show_detail
has 122 lines of code (exceeds 25 allowed). Consider refactoring. Open
def show_detail(detail, no_html=false, options={})
multiple = false
show_diff = false
no_details = false
Method to_image
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_image(format='PNG')
date_to = (@date_from >> @months) - 1
show_weeks = @zoom > 1
show_days = @zoom > 2
subject_width = 400
Method update
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def update
@page = @wiki.find_or_new_page(params[:id])
return render_403 unless editable?
was_new_page = @page.new_record?
- 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 calc_col_width
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def calc_col_width(issues, query, table_width, pdf)
# calculate statistics
# by captions
pdf.SetFontStyle('B', 8)
margins = pdf.get_margins
- 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 method_missing
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def method_missing(sym, *args, &block)
if args.count > 0
if args.first.is_a?(Hash)
if @struct.last.is_a?(Array)
@struct.last << args.first unless block
- 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 coordinates
has a Cognitive Complexity of 32 (exceeds 5 allowed). Consider refactoring. Open
def coordinates(start_date, end_date, progress, zoom=nil)
zoom ||= @zoom
coords = {}
if start_date && end_date && start_date <= self.date_to && end_date >= self.date_from
if start_date >= self.date_from
- 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 preparation.rb
has 361 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Redmine
module Preparation
def self.prepare
ApplicationRecord.include Redmine::Acts::Positioned
ApplicationRecord.include Redmine::Acts::Mentionable
Method html_task
has 115 lines of code (exceeds 25 allowed). Consider refactoring. Open
def html_task(params, coords, markers, label, object)
output = +''
data_options = {}
if object
data_options[:collapse_expand] = "#{object.class}-#{object.id}".downcase
Method run
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def run(options={})
max_items = options[:max_items]
max_time = options[:max_time]
current = 0
imported = 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 requires_redmine
has a Cognitive Complexity of 31 (exceeds 5 allowed). Consider refactoring. Open
def requires_redmine(arg)
arg = {:version_or_higher => arg} unless arg.is_a?(Hash)
arg.assert_valid_keys(:version, :version_or_higher)
current = Redmine::VERSION.to_a
- 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_object
has 113 lines of code (exceeds 25 allowed). Consider refactoring. Open
def build_object(row, item)
issue = Issue.new
issue.author = user
issue.notify = !!ActiveRecord::Type::Boolean.new.cast(settings['notifications'])
Class MailHandler
has 35 methods (exceeds 20 allowed). Consider refactoring. Open
class MailHandler < ActionMailer::Base
include ActionView::Helpers::SanitizeHelper
include Redmine::I18n
class UnauthorizedAction < StandardError; end
Method to_pdf
has 111 lines of code (exceeds 25 allowed). Consider refactoring. Open
def to_pdf
pdf = ::Redmine::Export::PDF::ITCPDF.new(current_language)
pdf.SetTitle("#{l(:label_gantt)} #{project}")
pdf.alias_nb_pages
pdf.footer_date = format_date(User.current.today)
Method sql_for_relations
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def sql_for_relations(field, operator, value, options={})
relation_options = IssueRelation::TYPES[field]
return relation_options unless relation_options
relation_type = field
- 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 allowed_to?
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def allowed_to?(action, context, options={}, &block)
if context && context.is_a?(Project)
return false unless context.allows_to?(action)
# Admin users are authorized for anything else
return true if admin?
- 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 blocks
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def blocks( text, deep_code = false )
text.replace( text.split( BLOCKS_GROUP_RE ).collect do |blk|
plain = blk !~ /\A[#*> ]/
# skip blocks that are complex HTML
- 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 find_current_user
has a Cognitive Complexity of 30 (exceeds 5 allowed). Consider refactoring. Open
def find_current_user
user = nil
unless api_request?
if session[:user_id]
# existing session
- 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 CustomField
has 34 methods (exceeds 20 allowed). Consider refactoring. Open
class CustomField < ApplicationRecord
include Redmine::SafeAttributes
include Redmine::SubclassFactory
has_many :enumerations,
File repositories_controller.rb
has 344 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'digest/sha1'
require 'redmine/scm/adapters'
class ChangesetNotFound < StandardError; end
class InvalidRevisionParam < StandardError; end
Method journalize_changes
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def journalize_changes
# attributes changes
if @attributes_before_change
attrs = (journalized.journalized_attribute_names + @attributes_before_change.keys).uniq
attrs.each do |attribute|
- 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"