Showing 14 of 106 total issues
File materialize.clockpicker.js
has 523 lines of code (exceeds 250 allowed). Consider refactoring. Open
/* jshint ignore:start */
/*!
* ClockPicker v0.0.7 (http://weareoutman.github.io/clockpicker/)
* Copyright 2014 Wang Shenwei.
* Licensed under MIT (https://github.com/weareoutman/clockpicker/blob/gh-pages/LICENSE)
- Create a ticketCreate a ticket
Function ClockPicker
has 196 lines of code (exceeds 25 allowed). Consider refactoring. Open
function ClockPicker(element, options) {
var popover = $(tpl), plate = popover.find('.clockpicker-plate'), holder = popover.find('.picker__holder'), hoursView = popover.find('.clockpicker-hours'), minutesView = popover.find('.clockpicker-minutes'), amPmBlock = popover.find('.clockpicker-am-pm-block'), isInput = element.prop('tagName') === 'INPUT', input = isInput ? element : element.find('input'), label = $('label[for=' + input.attr('id') + ']'), self = this, timer;
this.id = uniqueId('cp');
this.element = element;
this.holder = holder;
- Create a ticketCreate a ticket
Function highLight
has 146 lines of code (exceeds 25 allowed). Consider refactoring. Open
function highLight() {
var fields = [
'id',
'_destroy',
'day',
- Create a ticketCreate a ticket
Function setHand
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
ClockPicker.prototype.setHand = function (x, y, roundBy5, dragging) {
var radian = Math.atan2(x, -y), isHours = this.currentView === 'hours', unit = Math.PI / (isHours || roundBy5 ? 6 : 30), z = Math.sqrt(x * x + y * y), options = this.options, inner = isHours && z < (outerRadius + innerRadius) / 2, radius = inner ? innerRadius : outerRadius, value;
if (options.twelvehour) {
radius = outerRadius;
}
- Create a ticketCreate a ticket
Function initialize
has 73 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initialize() {
var mapOptions = {
center: new google.maps.LatLng(-33.8688, 151.2195),
zoom: 13
};
- Create a ticketCreate a ticket
Function countdown
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
function countdown(val) {
var minutes = val;
$('#counter').css({
'font-size': '3rem',
'padding': '0 10px',
- Read upRead up
- Create a ticketCreate a ticket
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 show
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
ClockPicker.prototype.show = function (e) {
// Not show again
if (this.isShown) {
return;
}
- Create a ticketCreate a ticket
Function mousedown
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
function mousedown(e, space) {
var offset = plate.offset(), isTouch = /^touch/.test(e.type), x0 = offset.left + dialRadius, y0 = offset.top + dialRadius, dx = (isTouch ? e.originalEvent.touches[0] : e).pageX - x0, dy = (isTouch ? e.originalEvent.touches[0] : e).pageY - y0, z = Math.sqrt(dx * dx + dy * dy), moved = false;
// When clicking on minutes view space, check the mouse position
if (space && (z < outerRadius - tickRadius || z > outerRadius + tickRadius)) {
return;
- Create a ticketCreate a ticket
Function countdown
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function countdown(val) {
var minutes = val;
$('#counter').css({
'font-size': '3rem',
'padding': '0 10px',
- Create a ticketCreate a ticket
Method api_login
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def api_login
token = params[:token]
provider = params[:provider]
if token.blank? || ENV[provider].nil?
render_api_response(invalid_token, 417)
- Read upRead up
- Create a ticketCreate a ticket
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
Consider simplifying this complex logical expression. Open
if (place.address_components) {
address = [
place.address_components[0] && place.address_components[0].short_name || '',
place.address_components[1] && place.address_components[1].short_name || '',
place.address_components[2] && place.address_components[2].short_name || ''
- Create a ticketCreate a ticket
Method link_to_add_fields
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def link_to_add_fields(name, f, model_class, association, cssclass, title)
- Create a ticketCreate a ticket
Method ticket_quantity_specified?
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ticket_quantity_specified?
if ticket_params.values.map(&:to_i).inject(:+) <= 0
flash[:notice] = ticket_quantity_empty
redirect_to :back
else
- Read upRead up
- Create a ticketCreate a ticket
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 event_price
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def event_price(tickets, event)
if user_is_attending_event(event)
"Attending"
elsif tickets.max == tickets.min
tickets.max.zero? ? "Free" : number_to_currency(tickets.max, unit: "$")
- Read upRead up
- Create a ticketCreate a ticket
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"