Showing 20 of 78 total issues
Function render
has 226 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
let errors = this.props.errors.map( error =>
<li key={error}> {error} </li>
)
File chatroom_add.jsx
has 339 lines of code (exceeds 250 allowed). Consider refactoring. Open
import React from 'react';
import { Link } from 'react-router-dom';
import Cable from 'actioncable';
Function render
has 91 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
let channels = [];
let directMessages = [];
this.props.chatrooms.forEach( chatroom => {
Function render
has a Cognitive Complexity of 25 (exceeds 5 allowed). Consider refactoring. Open
render () {
let errors = this.props.errors.map( error =>
<li key={error}> {error} </li>
)
- 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 71 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
{ document.title = `Where work happens | hype`}
const navBar = this.props.currentUser ? (
<Link to="/chatrooms"><div className="landing-page-nav-button purple-button">YOUR CHANNELS</div></Link>
) : (
Function render
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
let errors = this.props.errors.map( error =>
<li key={error}> {error} </li>
)
Function submitDemo
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
submitDemo(){
let demoMessages = [
"You look nice today",
"Where are the TPS reports!!!!",
Function render
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
let errors = this.props.errors.map( error =>
<li key={error}> {error} </li>
)
Function render
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let chatroomTitle = "";
let welcomeMessage = "";
if ( this.props.currentChatroom ) {
if (this.props.currentChatroom.chatroom_type == 'channel') {
Function createSocket
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
createSocket(chatroomId) {
let cable;
if (process.env.NODE_ENV !== 'production') {
cable = Cable.createConsumer('http://localhost:3000/cable');
} else {
Function render
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
render () {
let errors = this.props.errors.map( error =>
<li key={error}> {error} </li>
)
Function render
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div className="sidebar-chatroom-details-container flex-column">
<div className="sidebar-chatroom-details-header flex">
<h3>{this.state.header}</h3>
Function createSocket
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
createSocket(chatroomId) {
let cable;
if (process.env.NODE_ENV !== 'production') {
cable = Cable.createConsumer('http://localhost:3000/cable');
} else {
- 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 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let chatroomTitle = "";
let userList = "";
let numUsers = 0;
Function render
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
return (
<div className="sidebar-chatroom-details-container flex-column">
{ this.props.currentUser ? (
<>
Function Footer
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
const Footer = () => {
return (
<div className="footer flex">
<div className="footer-left">
Function render
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
render() {
let name;
if (this.props.currentUser) {
if (this.props.currentUser.alias) {
name = this.props.currentUser.alias;
Function displayChannelList
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
{ this.state.chatrooms.map( chatroom => {
{ if (chatroom.chatroom_type === 'channel' && chatroom.title.toLowerCase().includes(this.state.inputBox.toLowerCase()) ) {
return (
<Link key={`chatroom-${chatroom.id}`}
to={`/chatrooms/${chatroom.id}`}
Function componentDidUpdate
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
componentDidUpdate(previousProps) {
if (this.props.match.params.chatroomId != previousProps.match.params.chatroomId) {
this.props.fetchUser(this.props.currentUser.id);
this.props.fetchMessages(this.props.match.params.chatroomId)
.then( () => $('#message-window').scrollTop($('#message-window')[0].scrollHeight), 500);
- 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 a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
render() {
let chatroomTitle = "";
let welcomeMessage = "";
if ( this.props.currentChatroom ) {
if (this.props.currentChatroom.chatroom_type == 'channel') {
- 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"