Showing 37 of 70 total issues
Function dataCallback
has a Cognitive Complexity of 59 (exceeds 5 allowed). Consider refactoring. Open
function dataCallback ({calendarType, dateFrom, dateTo, calendarId}, callback) {
// FIXME: until `me` is a valid shortcut on Sirius
if (calendarId === 'me' && calendarType === 'people') {
calendarId = username
}
- 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 dataCallback
has 121 lines of code (exceeds 25 allowed). Consider refactoring. Open
var dataCallback = function(params, callback) {
const {calendarType, calendarId, dateFrom: from, dateTo: to} = params
setTimeout(function(from, to) {
var data = [];
Function render
has 117 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { locale, layout, eventsColors, fullWeek, facultyGrid } = this.props.settings
const handleSettingChange = (k, v) => this.props.onSettingChange.bind(null, k, v)
return (
<div
Function render
has 102 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const {onErrorHide, type, visible} = this.props
if (!visible) {
// null or false is legit to render for React
return null
Function requestHandler
has 84 lines of code (exceeds 25 allowed). Consider refactoring. Open
function requestHandler (request) {
if (request.readyState === XMLHttpRequest.DONE) {
if (request.status === 200) {
// Request successful
const ajaxresult = JSON.parse(request.responseText)
Function render
has 82 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
// FIXME: side effects!!!
const props = this.props
const { locale, layout, fullWeek, eventsColors, facultyGrid } = props.settings
Function render
has 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const viewMoment = this.viewDateMoment()
const monthEnd = viewMoment().endOf('month').endOf('isoWeek')
const weeks = [ [], [], [], [], [], [], [] ]
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const layout = isScreenLarge(this.props.screenSize) ? this.props.layout : 'vertical'
const dayCount = (this.props.days7 || isScreenSmall(this.props.screenSize) ? 7 : 5)
const timeline = createTimeline(this.props.grid)
Function semesterDataCallback
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
var semesterDataCallback = function(callback) {
setTimeout(function() {
callback([{
Function render
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
render () {
const viewMoment = this.viewDateMoment()
const monthEnd = viewMoment().endOf('month').endOf('isoWeek')
const weeks = [ [], [], [], [], [], [], [] ]
- 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 render
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const searchResultsClass = 'Search-results' +
(this.props.searchResults.length ? ' is-active' : '')
return (
Function data
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
const data = responseEvents.map(event => {
// And add new event to array
const newEvent = {
id: event.id,
name: event.name,
Function render
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
const { expanded, data, colored, onClick } = this.props
const onClickVal = expanded ? null : data.id
const headSpaceStyle = expanded ? {height: EVENT_HEAD_HEIGHT} : {}
Function calculateOverlap
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
export function calculateOverlap (events) {
let lastend = moment(0)
const sortByStart = ({startsAt: lhs}, {startsAt: rhs}) => {
const lhsD = moment(lhs)
Function data
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
export default function data (state = initialState, action) {
switch (action.type) {
case EVENTS_LOAD_STARTED:
return {
...state,
Function createDayEvents
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createDayEvents (props, animationDirection, events) {
// warn: mutates the given value!
const hideFilteredEvent = (event) => {
if (!props.displayFilter[event.type]) {
event._appear = 'hide'
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
let functionToRender
if (this.props.opened === 'settings') {
functionToRender = (
Function getPositionStyle
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
function getPositionStyle ({layout, align, data, expanded, screenSize}) {
const length = data._length * 100 + '%'
const position = data._position * 100 + '%'
const isHorizontal = isScreenLarge(screenSize) && layout === 'horizontal'
- 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 createStore
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createStore (initialState) {
const middlewares = [
thunk,
]
Function render
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
return (
<div className="functions-bar">
<button
type="button"