Showing 27 of 27 total issues
Function render
has 63 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div id="profile-page">
<ConnectedProfileNavbar history={this.props.history} />
<ProfileBody
Function checkDateNotTaken
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static checkDateNotTaken(req, res, next) {
const { eventId } = req.params;
// Check date is deined in body.
if (req.body.date) {
Function render
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
return (
<div id="discover-page">
{this.renderDiscoverNavBar()}
<DiscoverBody showViewCenterModal={this.showViewCenterModal} />
Function render
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const classes = classNames({ 'io-modal': true, hide: !this.props.showModifyEventModal });
const eventId = this.props.modifyEventModalState.id;
let title;
let description;
Function render
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const classes = classNames({ 'io-modal': true, hide: !this.props.showViewCenterModal });
const {
picture1, name, type, location, available, price, events,
Function render
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
let events = [];
// Populate events with user events if it exists.
if (this.props.event.events) {
Function render
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const classes = classNames({ 'io-modal': true, hide: !this.props.showModifyCenterModal });
const facilityList = ['Chairs', 'Tables', 'Parking Lot', 'Rest Rooms', 'Telescreens', 'Stage'];
const availablility = ['Available'];
const centerId = this.props.modifyCenterModalState.id;
Consider simplifying this complex logical expression. Open
Open
if (center) {
center
.update({
name: req.body.name || center.name,
description: req.body.description || center.description,
Function createCenter
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static createCenter(token, details, successFunc, failFunc) {
return (dispatch) => {
// If user chooses an image.
if (details.file && details.file !== []) {
// Upload image
Function modifyCenter
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static modifyCenter(token, details, param, successFunc, failFunc) {
return (dispatch) => {
// If user chooses an image.
if (details.file && details.file !== []) {
// Upload image
Function eventCardElements
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const eventCardElements = events.map((event) => {
// Get details of each event.
const { title, center, date } = event;
const { name, location } = center;
let { picture1 } = center;
Function getAllCenters
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static getAllCenters(req, res) {
// Check if path contains name query.
if (req.query.name) {
EventCenterController.getCentersByName(req, res);
} else {
Function render
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const classes = classNames({ 'io-modal': true, hide: !this.props.showAddCenterModal });
const facilityList = ['Chairs', 'Tables', 'Parking Lot', 'Rest Rooms', 'Telescreens', 'Stage'];
const availablility = ['Available'];
Function createUser
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static createUser(req, res) {
if (
req.body.password === undefined ||
req.body.password === null ||
req.body.password.length < 5
Function modifyCenter
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static modifyCenter(req, res) {
EventCenter
.findOne({ where: { id: req.params.centerId } })
.then((center) => {
if (center) {
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render() {
const centers = [...this.props.center.centers];
// Count
let count = -1;
Function ConfirmModal
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
const ConfirmModal = (props) => {
const {
message, show, type, confirmText, callback,
} = props.confirmModalState;
Function modifyUserProfile
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static modifyUserProfile(req, res) {
User
.findOne({ where: { id: req.user.id } })
.then((user) => {
if (user) {
Function getAllEvents
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
static getAllEvents(req, res) {
const page = (req.query.page && Number(req.query.page) > 0) ? Number(req.query.page) : 1;
const interval = 10;
const offset = (page * interval) - interval;
const limit = offset + interval;
Function render
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
Open
render() {
let events = [];
// Populate events with user events if it exists.
if (this.props.event.events) {
- 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"