ikenjoku/Book-A-Meal

View on GitHub

Showing 32 of 32 total issues

File mocks.js has 390 lines of code (exceeds 250 allowed). Consider refactoring.
Open


export const meals = [
  {
    id: 0,
    name: 'Nigerian Jollof',
Severity: Minor
Found in client/__test__/mocks.js - About 5 hrs to fix

    File mealController.spec.js has 348 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    import chai from 'chai';
    import chaiHttp from 'chai-http';
    
    import app from '../../app';
    
    
    Severity: Minor
    Found in server/test/controllers/mealController.spec.js - About 4 hrs to fix

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

        render() {
          return (
            <main className="manage-meals-content">
              <h2 className="center cool-lg-text">Manage Meals</h2>
              <Link className="addMealLink" to="/meals/create"><div className="addMealLinkD">Add a New Meal</div></Link>
      Severity: Major
      Found in client/components/ManageMeals/MealList.jsx - About 3 hrs to fix

        File userController.spec.js has 321 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        import chai from 'chai';
        import chaiHttp from 'chai-http';
        import bcrypt from 'bcrypt';
        
        import app from '../../app';
        Severity: Minor
        Found in server/test/controllers/userController.spec.js - About 3 hrs to fix

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

          render() {
            return (
              this.props.isLoggedIn === true ? <Redirect to="/menu" /> :
              <main className="signup-bg">
                <form id="signup-form" className="form-wrapper" onSubmit={this.onSubmit}>
          Severity: Major
          Found in client/components/Auth/Signup.jsx - About 3 hrs to fix

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

              render() {
                const renderedContent = this.props.currentMenu.date ?
                  (
                    <div className="menu-card">
                      <h3>Menu for {moment(this.props.currentMenu.date).format('dddd, MMMM Do YYYY')}</h3>
            Severity: Major
            Found in client/components/SetupMenu/MenuCard.jsx - About 3 hrs to fix

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

                render() {
                  const { currentOrders } = this.props;
                  const pendingOrders = currentOrders.filter(order => order.status === 'pending');
              
                  return (
              Severity: Major
              Found in client/components/Menu/CurrentOrderTable.jsx - About 2 hrs to fix

                Function orderReducer has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                const orderReducer = (state = initialState.orderReducer, action) => {
                  let orders;
                  let deliveredOrder;
                  let previousOrders;
                  switch (action.type) {
                Severity: Major
                Found in client/reducers/orderReducer.js - About 2 hrs to fix

                  File end-to-end-tests.js has 270 lines of code (exceeds 250 allowed). Consider refactoring.
                  Open

                  const path = require('path');
                  const moment = require('moment');
                  
                  const today = new Date().toISOString().substr(0, 10);
                  
                  
                  Severity: Minor
                  Found in e2e-tests/end-to-end-tests.js - About 2 hrs to fix

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

                      render() {
                        return (
                          <div>
                            <form
                              id="meal-form"
                    Severity: Major
                    Found in client/components/ManageMeals/MealForm.jsx - About 2 hrs to fix

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

                        render() {
                          const { menu } = this.props;
                          return (
                            <div>
                              {menu.Meals.length > 0 ?
                      Severity: Major
                      Found in client/components/Menu/MenuList.jsx - About 2 hrs to fix

                        Function createOrder has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          static createOrder(req, res, next) {
                            const userId = req.user.id;
                            const { mealId } = req.body;
                            const quantity = Number(req.body.quantity);
                            const date = new Date().toISOString().substr(0, 10);
                        Severity: Minor
                        Found in server/controllers/orders.js - About 1 hr to fix

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

                            render() {
                              return (
                                <form
                                  className="menu-setup-form"
                                  onSubmit={this.handleSubmit}
                          Severity: Minor
                          Found in client/components/SetupMenu/MealSetupForm.jsx - About 1 hr to fix

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

                              render() {
                                return (
                                  this.props.isLoggedIn === true ? <Redirect to="/menu" /> :
                                  <main className="mainContent login-bg">
                                    <form id="login-form" className="form-wrapper" onSubmit={this.onSubmit}>
                            Severity: Minor
                            Found in client/components/Auth/Login.jsx - About 1 hr to fix

                              Function create has 39 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                static create(req, res, next) {
                                  const userData = { ...req.body, isAdmin: undefined };
                                  const username = userData.username;
                                  const email = userData.email;
                              
                              
                              Severity: Minor
                              Found in server/controllers/users.js - About 1 hr to fix

                                Function setupMenuReducer has 38 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                const setupMenuReducer = (state = initialState.setupMenuReducer, action) => {
                                  switch (action.type) {
                                    case FETCH_MENU_SUCCESS:
                                      return { ...state, currentMenu: action.currentMenu, error: null };
                                    case FETCH_MENU_FAILURE:
                                Severity: Minor
                                Found in client/reducers/setupMenuReducer.js - About 1 hr to fix

                                  Function exports has 37 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                  module.exports = (sequelize, DataTypes) => {
                                    const Order = sequelize.define('Order', {
                                      date: {
                                        type: DataTypes.DATEONLY,
                                        allowNull: false,
                                  Severity: Minor
                                  Found in server/models/order.js - About 1 hr to fix

                                    Function validateMealChange has 36 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                    export const validateMealChange = (req, res, next) => {
                                      if (req.body.newMealId) {
                                        const todaysdate = new Date().toISOString().substr(0, 10);
                                        const newMealId = Number(req.body.newMealId);
                                        return Meal.findById(newMealId)
                                    Severity: Minor
                                    Found in server/middlewares/validateInputs.js - About 1 hr to fix

                                      Function validateSignup has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                      export const validateSignup = (req, res, next) => {
                                        delete req.body.id;
                                        delete req.body.isAdmin;
                                        const { firstname, lastname, username, email, password, confirmPassword } = req.body;
                                        if (!firstname || typeof firstname !== 'string') {
                                      Severity: Minor
                                      Found in server/middlewares/validateInputs.js - About 1 hr to fix

                                        Function login has 34 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                          static login(req, res, next) {
                                            const userEmail = req.body.email;
                                            const password = req.body.password;
                                            return User.findOne({ where: { email: userEmail } }).then((user) => {
                                              if (!user) {
                                        Severity: Minor
                                        Found in server/controllers/users.js - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language