Showing 46 of 126 total issues
Function palette
has a Cognitive Complexity of 121 (exceeds 5 allowed). Consider refactoring. Open
Open
var palette = (function() {
var proto = Array.prototype;
var slice = function(arr, opt_begin, opt_end) {
return proto.slice.apply(arr, proto.slice.call(arguments, 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
File palette.js
has 855 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/** @license
*
* Colour Palette Generator script.
* Copyright (c) 2014 Google Inc.
*
Function palette
has 239 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var palette = (function() {
var proto = Array.prototype;
var slice = function(arr, opt_begin, opt_end) {
return proto.slice.apply(arr, proto.slice.call(arguments, 1));
Class WebsiteDecorator
has 43 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class WebsiteDecorator < ApplicationDecorator
delegate_all
delegate :title, :author, :description, to: :meta_data
DEFAULT_LINKS = {
Class Proposal
has 42 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Proposal < ApplicationRecord
include Proposal::State
has_many :public_comments, dependent: :destroy
has_many :internal_comments, dependent: :destroy
Class ProposalDecorator
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ProposalDecorator < ApplicationDecorator
include Proposal::State
decorates :proposal
delegate_all
decorates_association :speakers
Class Event
has 36 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Event < ApplicationRecord
has_many :teammates, dependent: :destroy
has_many :staff, through: :teammates, source: :user
has_many :proposals, dependent: :destroy
has_many :speakers
Function render
has 103 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let { sessionFormats, closeBulkTimeSlotModal, counts } = this.props;
let { timeError, day, startTimes, duration } = this.state;
const days = Object.keys(counts);
Function Scheme
has 101 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
palette.Scheme = function(name, opt_groups) {
/**
* A map from a number to a colour palettes with given number of colours.
* @type {!Object<number, palette.Palette>}
*/
Class ApplicationController
has 32 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ApplicationController < ActionController::Base
include Pundit::Authorization
include ActivateNavigation
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
Function render
has 98 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const { slot, matchedSession, unscheduledSessions, tracks, sessionFormats, roomName } = this.props;
const { sessionSelected } = this.state;
File Schedule.js
has 320 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
import React, { Component } from 'react';
import PropTypes from 'prop-types';
import { Nav } from './Schedule/Nav';
import { Ruler } from './Schedule/Ruler';
Function render
has 88 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
counts,
dayViewing,
startTime,
Class TimeSlotDecorator
has 28 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Staff::TimeSlotDecorator < Draper::Decorator
decorates :time_slot
delegate_all
def start_time
Class EventStats
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class EventStats
attr_reader :event
def initialize(event)
Function render
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
height,
room,
startTime,
Function render
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const {
slot,
ripTime,
startTime,
Class ProgramSession
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class ProgramSession < ApplicationRecord
LIVE = 'live' # confirmed accepted
DRAFT = 'draft' # created by organizer, not ready to be published (live)
UNCONFIRMED_ACCEPTED = 'unconfirmed accepted' # accepted, to be confirmed by speaker
UNCONFIRMED_WAITLISTED = 'unconfirmed waitlisted'
Class EventsController
has 21 methods (exceeds 20 allowed). Consider refactoring. Open
Open
class Staff::EventsController < Staff::ApplicationController
before_action :enable_staff_event_subnav
helper_method :sticky_template_test_email
Function exports
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
module.exports = function (api) {
var validEnv = ['development', 'test', 'production'];
var currentEnv = api.env();
var isDevelopmentEnv = api.env('development');
var isProductionEnv = api.env('production');