jameshawkinsjr/hype

View on GitHub

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> 
            )
Severity: Major
Found in frontend/components/chat/chatroom_add.jsx - About 1 day to fix

    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';
    
    
    
    Severity: Minor
    Found in frontend/components/chat/chatroom_add.jsx - About 4 hrs to fix

      Function render has 91 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          render () {
      
              let channels = [];
              let directMessages = [];
              this.props.chatrooms.forEach( chatroom => {
      Severity: Major
      Found in frontend/components/chat/chatroom_list.jsx - About 3 hrs to fix

        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> 
                    )
        Severity: Minor
        Found in frontend/components/chat/chatroom_add.jsx - About 3 hrs to fix

        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>
                ) : (
        Severity: Major
        Found in frontend/components/landing_page/landing_page.jsx - About 2 hrs to fix

          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> 
                      )
          Severity: Major
          Found in frontend/components/session/signup_form.jsx - About 2 hrs to fix

            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!!!!",
            Severity: Major
            Found in frontend/components/messages/message_window.jsx - About 2 hrs to fix

              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> 
                          )
              
              
              Severity: Major
              Found in frontend/components/session/login_form.jsx - About 2 hrs to fix

                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') {
                Severity: Minor
                Found in frontend/components/messages/message_window.jsx - About 1 hr to fix

                  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 {
                  Severity: Minor
                  Found in frontend/components/chat/chatroom_list.jsx - About 1 hr to fix

                    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> 
                                )
                    Severity: Minor
                    Found in frontend/components/messages/message_item_edit.jsx - About 1 hr to fix

                      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>
                      Severity: Minor
                      Found in frontend/components/sidebar/chatroom_details.jsx - About 1 hr to fix

                        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 {
                        Severity: Minor
                        Found in frontend/components/chat/chatroom_list.jsx - About 1 hr to fix

                        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;
                        Severity: Minor
                        Found in frontend/components/chat/chatroom_header.jsx - About 1 hr to fix

                          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 ? (
                                              <>
                          Severity: Minor
                          Found in frontend/components/sidebar/user_details.jsx - About 1 hr to fix

                            Function Footer has 27 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                            const Footer = () => {
                            
                                return (
                                    <div className="footer flex">
                                            <div className="footer-left">
                            Severity: Minor
                            Found in frontend/components/templates/footer.jsx - About 1 hr to fix

                              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;
                              Severity: Minor
                              Found in frontend/components/navbar/navbar.jsx - About 1 hr to fix

                                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}`}
                                Severity: Minor
                                Found in frontend/components/chat/chatroom_add.jsx - About 1 hr to fix

                                  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);
                                  Severity: Minor
                                  Found in frontend/components/messages/message_window.jsx - About 45 mins to fix

                                  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') {
                                  Severity: Minor
                                  Found in frontend/components/messages/message_window.jsx - About 35 mins to fix

                                  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

                                  Severity
                                  Category
                                  Status
                                  Source
                                  Language