Showing 215 of 292 total issues
Method auth
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
def auth
# Find user and check password
result = User.authenticate(params[:user][:login], params[:user][:password])
if result == :no_such_user
if mobile?
Function setOptions
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
setOptions: function(options) {
this.options = Object.extend({
choices: 10,
partialSearch: true,
partialChars: 2,
Function _begin
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
_begin: function() {
if (this._prepared) return;
var element = this.element;
if (isDisplayed(element)) {
Function select
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
select: function(element, value) {
if (Object.isUndefined(value))
return this[element.type == 'select-one' ?
'selectOne' : 'selectMany'](element);
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
Function setRequestHeaders
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
setRequestHeaders: function() {
var headers = {
'X-Requested-With': 'XMLHttpRequest',
'X-Prototype-Version': Prototype.Version,
'Accept': 'text/javascript, text/html, application/xml, text/xml, */*'
- 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 setStyle
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
setStyle: function(element, styles) {
element = $(element);
var elementStyle = element.style, match;
if (Object.isString(styles)) {
element.style.cssText += ';' + styles;
- 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 getElementsByClassName
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
if (!document.getElementsByClassName) document.getElementsByClassName = function(instanceMethods){
function iter(name) {
return name.blank() ? null : "[contains(concat(' ', @class, ' '), ' " + 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
Method amline_settings
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def amline_settings(period)
case period
when 0..90
avg_period = 3
when 91..365
- 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 wml_select
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def wml_select(name, values, default=nil, value_func = nil, value_text = nil)
ivalue = values.index(default)
wml = "<select name='#{name}'"
wml << " ivalue='#{ivalue+1}'" if ivalue
wml << ">"
- 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 currentcost
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def currentcost
# Receives data from my currentcost daemon
authenticate_with_http_basic do |username, password|
# Authenticate
result = User.authenticate(username, 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
Function baseInitialize
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
baseInitialize: function(element, update, options) {
element = $(element);
this.element = element;
this.update = $(update);
this.hasFocus = false;
Function encode
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
function encode(inputs)
{
for (var i = 0; i < inputs.length; ++i)
{
log("input[" + i + "]: " + inputs[i].name + " = " + inputs[i].value);
Function showPage
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
showPage: function(page, backwards)
{
if (page)
{
// if (window.iui_ext) window.iui_ext.injectEventMethods(page); // TG -- why was this comment left here??
Function setup
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
setup: function(){
function parseColor(color){
if (!color || ['rgba(0, 0, 0, 0)','transparent'].include(color)) color = '#ffffff';
color = color.parseColor();
return $R(0,2).map(function(i){
Function CHILD
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
CHILD: function(elem, match){
var type = match[1], node = elem;
switch (type) {
case 'only':
case 'first':
Function start
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
start: function(options) {
if (options && options.transition === false) options.transition = Effect.Transitions.linear;
this.options = Object.extend(Object.extend({ },Effect.DefaultOptions), options || { });
this.currentFrame = 0;
this.state = 'idle';
Function stopObserving
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
function stopObserving(element, eventName, handler) {
element = $(element);
var registry = Element.retrieve(element, 'prototype_event_registry');
if (!registry) return element;
Method emissions
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
def emissions
# Initialise result array
emissiondata = EmissionArray.new
# Create "last reading" trackers
last_kWh = 0;
Function finishDrag
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
finishDrag: function(event, success) {
this.dragging = false;
if(this.options.quiet){
Position.prepare();
Method import_from_partow_net_db
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.import_from_partow_net_db
file = open("GlobalAirportDatabase.txt")
# For each line in the file
file.each do |line|
# Split into data fields
- 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"