Showing 46 of 126 total issues
Function render
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const {
dayViewing,
startTime,
endTime,
Method incomplete_checklist_items
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def incomplete_checklist_items
missing_items = []
missing_items << "Event must have a url" unless url.present?
missing_items << "Event must have a start date" unless start_date
- 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 create_from_proposal
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def self.create_from_proposal(proposal)
self.transaction do
ps = ProgramSession.create!(event_id: proposal.event_id,
proposal_id: proposal.id,
title: proposal.title,
- 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 self
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
var self = function(number, varargs) {
number |= 0;
if (!number) {
return [];
}
Method website_params
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
def website_params
params
.require(:website)
.permit(
:logo,
Function render
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { sessions, unscheduledSessions, tracks } = this.props;
const { searchInput, isHidden } = this.state;
let display = isHidden ? 'none' : '';
let filteredSessions = unscheduledSessions.filter((session) => {
Function initTimeSlot
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
function initTimeSlot($slot) {
$slot.css({
height: ($slot.data('duration') * verticalScale) + 'px',
top: (($slot.data('starts') - dayStart) * verticalScale) + 'px'
});
Function initialize
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
initialize () {
this.tinyMCEDefaults = {
height: 500,
menubar: false,
plugins: [
Method after_sign_in_path_for
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def after_sign_in_path_for(user)
if session[:pending_invite_accept_url]
session[:pending_invite_accept_url]
elsif !user.complete?
edit_profile_path
- 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 listSchemes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
palette.listSchemes = function(name, opt_number) {
if (!opt_number) {
opt_number = 2;
} else if (opt_number < 0) {
opt_number = -opt_number;
Method embed
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def embed(body)
body.tap do |body|
TAGS.each do |tag, template|
body.gsub!(tag) do
args = tag.is_a?(Regexp) ? extract($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
Method from_omniauth
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.from_omniauth(auth, invitation_email=nil)
where(provider: auth.provider, uid: auth.uid).first_or_create do |user|
password = Devise.friendly_token[0,20]
user.name = auth['info']['name'] if user.name.blank?
user.email = invitation_email || auth['info']['email'] || '' if user.email.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
Method set_cache_headers
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def set_cache_headers
return unless Rails.configuration.action_controller.perform_caching
server_cache_age =
current_website.caching_off? ? 0 : ENV.fetch('CACHE_CONTROL_S_MAXAGE', 1.week)
- 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 finalize
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def finalize
transaction do
update_state(SOFT_TO_FINAL[state]) if SOFT_TO_FINAL.key?(state)
if becomes_program_session?
ps = ProgramSession.create_from_proposal(self)
- 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 postBulkTimeSlots
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
export function postBulkTimeSlots(path, day, rooms, duration, startTimes) {
Function withColorFunction
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
palette.Scheme.withColorFunction = function(name, groups,
func, opt_is_cbf, opt_cyclic) {
Function fromPalettes
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
palette.Scheme.fromPalettes = function(name, groups,
palettes, opt_max, opt_cbf_max) {
Function generate
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
palette.generate = function(color_func, number, opt_start, opt_end,
opt_cyclic) {
Method create_time_slots
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def create_time_slots
slots = build_time_slots
TimeSlot.transaction do
slots.each do |s|
unless s.save
- 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 function. Open
return null;