Showing 327 of 327 total issues
Method burnup_extracted_from_show
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def burnup_extracted_from_show
start, step, interval, range, tick = @widget.calculate_start_step_interval_range_tick(tz)
filter = filter_from_filter_by
@items = []
Method name_from_worklog
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def name_from_worklog(w, r)
if r == 1
"#{w.task.issue_num} <a href=\"/tasks/view/#{w.task.task_num}\">#{ERB::Util.h w.task.name}</a> <br /><small>#{ERB::Util.h w.task.full_name}</small>".html_safe
elsif r == 2
w.is_a?(Tag) ? "#{w.name}" : I18n.t('worklog_reports.status.none')
Method event_logs_for_timeline
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.event_logs_for_timeline(current_user, params)
tz = TZInfo::Timezone.new(current_user.time_zone)
now = tz.now
filter_project = params[:filter_project].to_i
Method init_start_and_end_dates
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def init_start_and_end_dates(params)
range = params[:range].to_i
case range
when 0
# Today
Method receive
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def receive(email)
# create wrapper email object
wrapper = Mailman::Email.new(email)
logger.tagged('EMAIL TRACKING') { logger.info 'receive wrapper' }
Function bindEvents
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
TaskNotificationEditor.prototype.bindEvents = function () {
var self = this;
// add me click
$('#add_me').click(function () {
Function bindEvents
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
ServiceEditor.prototype.bindEvents = function () {
var self = this;
// set up autocomplete for customer
$("#service-edit-autocomplete-for-customer").autocomplete({
Method create_csv
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_csv
csv_string = ''
if @column_headers
CSV.generate(csv_string, :col_sep => ',') do |csv|
Method file_type_image
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
def file_type_image(ft)
return case ft.file_extension
when 'doc' then
'document.png'
when 'zip' then
Method create
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def create
@task.task_due_calculation(params[:task][:due_at], current_user)
@task.duration = TimeParser.parse_time(params[:task][:duration])
@task.duration = 0 if @task.duration.nil?
if @task.service_id == -1
- 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 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@task = AbstractTask.accessed_by(current_user).find_by(:id => params[:id])
if @task.nil?
flash[:error] = t('flash.error.not_exists_or_no_permission', model: TaskRecord.model_name.human)
redirect_from_last and return
Method burndown_extracted_from_show
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
def burndown_extracted_from_show
start, step, interval, range, tick = @widget.calculate_start_step_interval_range_tick(tz)
filter = filter_from_filter_by
@items = []
Function Gantt
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.Gantt = (function ($) {
function Gantt(options) {
this.options = options;
this.init();
Function CustomAttributeEdit
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
jobsworth.CustomAttributeEdit = (function ($) {
function CustomAttributeEdit(options) {
this.options = options;
this.init();
Method get_body
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.get_body(email)
body = nil
if email.multipart?
email.parts.each do |m|
next if body
- 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 validate_attributes
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def validate_attributes
# check attributes are valid
invalid = resource_attributes.select { |attr| !attr.check_regex }
res = invalid.empty?
- 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 render_task_dependants
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
def render_task_dependants(t, depth, root_present)
res = ''
@printed_ids ||= []
return if @printed_ids.include? t.id
Method remove
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def remove(perm)
case perm
when 'comment' then
self.can_comment = false
when 'work' then
Method search
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def search
search_criteria = params[:term].strip
@customers = []
@users = []
Method set
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def set(perm)
case perm
when 'comment' then
self.can_comment = 1
when 'work' then