Showing 14 of 38 total issues
File calendarReducer.js
has 372 lines of code (exceeds 250 allowed). Consider refactoring. Open
import Moment from 'moment';
import Immutable from 'immutable';
import * as Calendar from '../utils/calendar';
import { push } from 'react-router-redux';
import { fetchSheets, fetchHolidays, saveSheets, fetchCurrentAllocation } from '../api';
Function render
has 99 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
const { calendar: { selecteds } } = this.props;
const workPeriods = this.state.workPeriods;
const isSelectedsEmpty = selecteds.isEmpty();
Function exports
has 81 lines of code (exceeds 25 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
File user.rb
has 300 lines of code (exceeds 250 allowed). Consider refactoring. Open
ActiveAdmin.register User do
decorate_with UserDecorator
includes :mentor
Function render
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
render(){
const {
onPrev,
onNext,
onSelectWeek,
Method call
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def call
error_message = I18n.t('activerecord.errors.models.period.attributes.base.invalid_periods')
return Result.new(false, [error_message]) if !@additions.empty? && invalid_day_periods?
- 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 initialize
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
return if user.nil?
can :manage, Punch, user_id: user.id
can :read, User, id: user.id
- 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 by_created_date
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def by_created_date(query)
return query unless created_at_start.present? || created_at_end.present?
if created_at_start && created_at_end
query.where(evaluations: { created_at: created_at_start..created_at_end })
- 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 onToggle
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export const onToggle = (dispatch) => (day, selecteds) => {
return dispatch((dispatch, getState) => {
let newSelecteds = selecteds;
if(isSelected(selecteds, day)) {
newSelecteds = newSelecteds.delete(day);
- 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 authenticate_otp
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def authenticate_otp
VerifyUserAuthenticity.call(**verify_user_authenticity_params) do |result|
@user = result.user
return unless result.otp_required_for_login?
- 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 Day
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const Day = ({ day, selecteds, holidays, inner, onToggle, today, selected, sheet }) => {
let holiday = () => isHoliday(selecteds, day, holidays)
let overtime = () => overtimeAllowed()
let handleToggle = () => {
- 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 by_evaluation_date
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def by_evaluation_date(query)
return query unless evaluation_date_start.present? || evaluation_date_end.present?
if evaluation_date_start && evaluation_date_end
query.where(evaluations: { evaluation_date: evaluation_date_start..evaluation_date_end })
- 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 date_format
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def date_format
FIELDS_TO_BE_VALIDATED.each do |field|
next if self[field].blank?
errors.add(field, 'Invalid date') unless valid_date?(self[field])
- 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 exports
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
module.exports = function(api) {
var validEnv = ['development', 'test', 'production']
var currentEnv = api.env()
var isDevelopmentEnv = api.env('development')
var isProductionEnv = api.env('production')
- 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"