AppCypher/EventsManager

View on GitHub

Showing 27 of 27 total issues

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

  render() {
    return (
      <div id="profile-page">
        <ConnectedProfileNavbar history={this.props.history} />
        <ProfileBody
Severity: Major
Found in client/src/containers/Profile.js - About 2 hrs to fix

    Function checkDateNotTaken has 62 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static checkDateNotTaken(req, res, next) {
        const { eventId } = req.params;
    
        // Check date is deined in body.
        if (req.body.date) {
    Severity: Major
    Found in server/middleware/validation.js - About 2 hrs to fix

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

        render() {
          return (
            <div id="discover-page">
              {this.renderDiscoverNavBar()}
              <DiscoverBody showViewCenterModal={this.showViewCenterModal} />
      Severity: Major
      Found in client/src/containers/Discover.js - About 2 hrs to fix

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

          render() {
            const classes = classNames({ 'io-modal': true, hide: !this.props.showModifyEventModal });
            const eventId = this.props.modifyEventModalState.id;
            let title;
            let description;
        Severity: Major
        Found in client/src/components/ModifyEventModal.js - About 2 hrs to fix

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

            render() {
              const classes = classNames({ 'io-modal': true, hide: !this.props.showViewCenterModal });
          
              const {
                picture1, name, type, location, available, price, events,
          Severity: Major
          Found in client/src/components/ViewCenterModal.js - About 2 hrs to fix

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

              render() {
                let events = [];
            
                // Populate events with user events if it exists.
                if (this.props.event.events) {
            Severity: Major
            Found in client/src/components/ProfileEventCards.js - About 2 hrs to fix

              Function render has 54 lines of code (exceeds 25 allowed). Consider refactoring.
              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;
              Severity: Major
              Found in client/src/components/ModifyCenterModal.js - About 2 hrs to fix

                Consider simplifying this complex logical expression.
                Open

                        if (center) {
                          center
                            .update({
                              name: req.body.name || center.name,
                              description: req.body.description || center.description,
                Severity: Critical
                Found in server/controllers/center.js - About 2 hrs to fix

                  Function createCenter has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    static createCenter(token, details, successFunc, failFunc) {
                      return (dispatch) => {
                        // If user chooses an image.
                        if (details.file && details.file !== []) {
                          // Upload image
                  Severity: Minor
                  Found in client/src/actions/centerActions.js - About 1 hr to fix

                    Function modifyCenter has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      static modifyCenter(token, details, param, successFunc, failFunc) {
                        return (dispatch) => {
                          // If user chooses an image.
                          if (details.file && details.file !== []) {
                            // Upload image
                    Severity: Minor
                    Found in client/src/actions/centerActions.js - About 1 hr to fix

                      Function eventCardElements has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          const eventCardElements = events.map((event) => {
                            // Get details of each event.
                            const { title, center, date } = event;
                            const { name, location } = center;
                            let { picture1 } = center;
                      Severity: Minor
                      Found in client/src/components/ProfileEventCards.js - About 1 hr to fix

                        Function getAllCenters has 41 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          static getAllCenters(req, res) {
                            // Check if path contains name query.
                            if (req.query.name) {
                              EventCenterController.getCentersByName(req, res);
                            } else {
                        Severity: Minor
                        Found in server/controllers/center.js - About 1 hr to fix

                          Function render has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                          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'];
                          
                          
                          Severity: Minor
                          Found in client/src/components/AddCenterModal.js - About 1 hr to fix

                            Function createUser has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              static createUser(req, res) {
                                if (
                                  req.body.password === undefined ||
                                  req.body.password === null ||
                                  req.body.password.length < 5
                            Severity: Minor
                            Found in server/controllers/user.js - About 1 hr to fix

                              Function modifyCenter has 30 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                static modifyCenter(req, res) {
                                  EventCenter
                                    .findOne({ where: { id: req.params.centerId } })
                                    .then((center) => {
                                      if (center) {
                              Severity: Minor
                              Found in server/controllers/center.js - About 1 hr to fix

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

                                  render() {
                                    const centers = [...this.props.center.centers];
                                
                                    // Count
                                    let count = -1;
                                Severity: Minor
                                Found in client/src/components/DiscoverCenterCardRow.js - About 1 hr to fix

                                  Function ConfirmModal has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  const ConfirmModal = (props) => {
                                    const {
                                      message, show, type, confirmText, callback,
                                    } = props.confirmModalState;
                                  
                                  
                                  Severity: Minor
                                  Found in client/src/components/ConfirmModal.js - About 1 hr to fix

                                    Function modifyUserProfile has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      static modifyUserProfile(req, res) {
                                        User
                                          .findOne({ where: { id: req.user.id } })
                                          .then((user) => {
                                            if (user) {
                                    Severity: Minor
                                    Found in server/controllers/user.js - About 1 hr to fix

                                      Function getAllEvents has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                                      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;
                                      Severity: Minor
                                      Found in server/controllers/event.js - About 1 hr to fix

                                        Function render has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                                        Open

                                          render() {
                                            let events = [];
                                        
                                            // Populate events with user events if it exists.
                                            if (this.props.event.events) {
                                        Severity: Minor
                                        Found in client/src/components/ProfileEventCards.js - About 55 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