Showing 39 of 66 total issues
Function slide
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
, slide: function (type, next) {
var $active = this.$element.find('.active')
, $next = next || $active[type]()
, isCycling = this.interval
, direction = type == 'next' ? 'left' : 'right'
Method create
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
if params[:based_on]
@evaluation = Evaluation.based_on(Evaluation.find(params[:based_on]))
@evaluation.attributes = params[:evaluation]
else
Function _handleData
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_handleData: function(data) {
// update progress bar and text
$('#progress_bar').css('width', data.percentage + '%');
$('.completed').text(data.completed);
$('.total').text(data.total);
Method update
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def update
@evaluation.attributes = params[:evaluation]
# parse data
data = nil
Function _fnAddButtons
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
"_fnAddButtons": function ()
{
var
nButton,
sExclude = ","+this.s.aiExclude.join(',')+",";
Method responses_csv
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
def responses_csv(sep = ',')
CSV.generate(:col_sep => sep) do |csv|
# Pull out the fields that were uploaded with the original data,
# so that we can output these along with the task responses.
orig_fields_keys = if @task_responses.empty?
Function _handleData
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
_handleData: function(data) {
// update progress bar and text
$('#progress_bar').css('width', data.percentage + '%');
$('.completed').text(data.completed);
$('.total').text(data.total);
- 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 10 (exceeds 5 allowed). Consider refactoring. Open
def update
current_user.name = params[:user][:name] unless params[:user][:name].nil?
current_user.email = params[:user][:email] unless params[:user][:email].nil?
unless params[:user][:password].blank?
- 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 setupButtons
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
setupButtons: function(name, posSelector, negSelector, controlsSelector, spinnerSelector, positiveResponse) {
$(posSelector).add(negSelector).bind('ajax:before', function() {
// fade out the controls and fade in a spinner while we're loading
// the response
console.log(name, 'starting request');
Method mturk_run
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def mturk_run &block
init_if_needed
retries = 0
begin
- 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 setupButtons
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
setupButtons: function(name, posSelector, negSelector, controlsSelector, spinnerSelector, positiveResponse) {
Method link_to_add_fields
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def link_to_add_fields(name, icon, f, association, link_classes = '', create_children=nil)
Method auth
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def auth username, password
return nil unless @access_users.member?(username)
dn = dn_for username
@ldap.auth dn, password
- 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 too many return
statements within this method. Open
return :accounts
Avoid too many return
statements within this method. Open
return :other
Avoid too many return
statements within this method. Open
return :jobs
Avoid too many return
statements within this method. Open
return :login
Function updateChart
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
updateChart: function() {
// copy default options
var options = $.extend(true, {}, TaskResponses.barChartOptions);
// which question are we charting?
- 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 force_expire
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def force_expire task
hit_id = task.mturk_hit
return unless hit_id
begin
- 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"