Showing 19 of 29 total issues
File validate.js
has 929 lines of code (exceeds 250 allowed). Consider refactoring. Open
/**
* jQuery Validation Plugin 1.9.0
*
* http://bassistance.de/jquery-plugins/jquery-plugin-validation/
* http://docs.jquery.com/Plugins/Validation
Method sort
has a Cognitive Complexity of 26 (exceeds 5 allowed). Consider refactoring. Open
def sort
@max_position = Issue.where("status_id IS NULL or status_id IN (?) AND project_id IN (?)", STATUS_IDS[params[:new_status]],@hierarchy_project_id).maximum(:s2b_position)
@issue = Issue.find(params[:issue_id])
@old_position = @issue.s2b_position
if params[:id_next].to_i != 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 filter_issues
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def filter_issues
@sort_versions = {}
if session[:view_issue].nil? || session[:view_issue] == "board" && (params[:switch_screens] || "").blank?
redirect_to :controller => "s2b_boards", :action => "index" ,:project_id => params[:project_id]
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
Function validate
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
validate : function(options) {
// if nothing is selected, return nothing; can't chain anyway
if (!this.length) {
options && options.debug && window.console && console.warn("nothing selected, can't validate, returning nothing");
Function normalizeRules
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
normalizeRules : function(rules, element) {
// handle dependency check
$.each(rules, function(prop, val) {
// ignore rule when param is explicitly false, eg. required:false
if (val === false) {
Function remote
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
remote : function(value, element, param) {
if (this.optional(element))
return "dependency-mismatch";
var previous = this.previousValue(element);
Method filter_issues
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter_issues
@sort_versions = {}
if session[:view_issue].nil? || session[:view_issue] == "board" && (params[:switch_screens] || "").blank?
redirect_to :controller => "s2b_boards", :action => "index" ,:project_id => params[:project_id]
return
Method sort
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
def sort
@max_position = Issue.where("status_id IS NULL or status_id IN (?) AND project_id IN (?)", STATUS_IDS[params[:new_status]],@hierarchy_project_id).maximum(:s2b_position)
@issue = Issue.find(params[:issue_id])
@old_position = @issue.s2b_position
if params[:id_next].to_i != 0
Function rules
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
rules : function(command, argument) {
var element = this[0];
if (command) {
var settings = $.data(element.form, 'validator').settings;
Function check
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
check : function(element) {
element = this.validationTargetFor(this.clean(element));
var rules = $(element).rules();
var dependencyMismatch = false;
Method filter_issues
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def filter_issues
session[:params_select_version_onboard] = params[:select_version]
session[:params_select_member] = params[:select_member]
session[:conditions] = ["(1=1)"]
if session[:params_select_version_onboard] && session[:params_select_version_onboard] != "all"
Function init
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
init : function() {
this.labelContainer = $(this.settings.errorLabelContainer);
this.errorContext = this.labelContainer.length && this.labelContainer || $(this.currentForm);
this.containers = $(this.settings.errorContainer).add(this.settings.errorLabelContainer);
this.submitted = {};
Method editable_for_project?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def editable_for_project?
return @editable_for_project if @editable_for_project.present?
@viewable_for_project = true and return true if User.current.admin?
@user_roles = @user_roles || User.current.roles_for_project(@project)
- 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
Avoid deeply nested control flow statements. Open
issue.update_attribute(:s2b_position, issue.s2b_position.to_i - 1) if issue.id != @issue.id
Avoid deeply nested control flow statements. Open
elsif @next_position && @old_position > @next_position
@sort_issue = Issue.where("status_id IN (?) AND s2b_position < ? AND s2b_position >= ? AND project_id IN (?)", STATUS_IDS[params[:new_status]],@old_position,@next_position,@hierarchy_project_id)
@sort_issue.each do |issue|
issue.update_attribute(:s2b_position, issue.s2b_position.to_i + 1) if issue.id != @issue.id
end
Method viewable_for_project?
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def viewable_for_project?
return @viewable_for_project if @viewable_for_project.present?
@viewable_for_project = true and return true if User.current.admin?
@user_roles = @user_roles || User.current.roles_for_project(@project)
- 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_status
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_status
@issue = Issue.find(params[:issue_id])
unless @issue
render :json => {:result => "error", :message => "Unknow issue"}
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 set_status_settings
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def set_status_settings
@plugin = Redmine::Plugin.find("scrum2b")
@settings = Setting["plugin_#{@plugin.id}"]
# Loop to set default of settings items
need_to_resetting = 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 update
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def update
return unless find_issue_from_param
@issue.save_attachments(params[:attachments] || (params[:issue] && params[:issue][:uploads]))
if @issue.update_attributes(params[:issue])
- 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"