segunolalive/helloBooks

View on GitHub

Showing 33 of 36 total issues

Function BookForm has 163 lines of code (exceeds 25 allowed). Consider refactoring.
Open

const BookForm = (props) => {
  const categories = props.categories ?
    <Categories
      text='Select Book Category'
      categories={props.categories}
Severity: Major
Found in client/components/Admin/BookForm.jsx - About 6 hrs to fix

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

      render() {
        const loadingState = this.props.isLoading ?
          <Loading text='Creating your account' /> : null;
        return (
          this.props.isLoggedIn === true ?
    Severity: Major
    Found in client/components/auth/SignUp.jsx - About 4 hrs to fix

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

        render() {
          const loadingState = this.props.isLoading ?
            <Loading text='logging in' /> : null;
          return (
            this.props.isLoggedIn === true ?
      Severity: Major
      Found in client/components/auth/Login.jsx - About 3 hrs to fix

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

        import supertest from 'supertest';
        import { assert } from 'chai';
        import bcrypt from 'bcrypt';
        import sinon from 'sinon';
        
        
        Severity: Minor
        Found in server/test/controllers/userController.spec.js - About 3 hrs to fix

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

            render() {
              const loaderDisplay = this.props.fetchingBooks ?
                <Loading text="fetching awesome books . . ." /> :
                <div className="center">
                  <p style={{ fontWeight: 900 }}>
          Severity: Major
          Found in client/components/Library/index.jsx - About 3 hrs to fix

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

              render() {
                const actionButtons = this.props.isAdmin ? (
                  <div className="card-action">
                    <Button
                      className="teal darken-4 action-btn edit-btn"
            Severity: Major
            Found in client/components/Library/BookDetail.jsx - About 2 hrs to fix

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

                render() {
                  const renderPage = this.state.redirect === true ?
                    <Redirect to='/dashboard' /> :
                    <div>
                      <Header
              Severity: Major
              Found in client/components/Dashboard/UpdateProfile.jsx - About 2 hrs to fix

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

                  render() {
                    const imageUploading = this.state.cover && !this.state.book.cover;
                    const imageUploaded = this.state.cover === null && this.state.book.cover;
                    const bookFileUploading = this.state.bookFile && !this.state.book.bookFile;
                    const bookFileUploaded = this.state.bookFile === null &&
                Severity: Major
                Found in client/components/Admin/index.jsx - About 2 hrs to fix

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

                    borrowBook(req, res, next) {
                      const userId = req.params.id;
                      const bookId = req.body.id;
                      Book.findById(bookId)
                        .then((book) => {
                  Severity: Major
                  Found in server/controllers/BookController.js - About 2 hrs to fix

                    File index.jsx has 257 lines of code (exceeds 250 allowed). Consider refactoring.
                    Open

                    import React, { Component } from 'react';
                    import PropTypes from 'prop-types';
                    import { connect } from 'react-redux';
                    import { Redirect } from 'react-router-dom';
                    import { Col, Row } from 'react-materialize';
                    Severity: Minor
                    Found in client/components/Admin/index.jsx - About 2 hrs to fix

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

                      const Borrowed = (props) => {
                        const books = props.borrowedBooks && props.borrowedBooks.length ?
                          props.borrowedBooks.map(book =>
                            <Col key={book.title} s={12} className="book-info grey-tex">
                              <div className="card horizontal">
                      Severity: Major
                      Found in client/components/Dashboard/Borrowed.jsx - About 2 hrs to fix

                        Function up has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          up(queryInterface, Sequelize) {
                            return queryInterface.createTable('Users', {
                              id: {
                                allowNull: false,
                                autoIncrement: true,
                        Severity: Major
                        Found in server/migrations/20170821170951-create migration for user table.js - About 2 hrs to fix

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

                            up(queryInterface, Sequelize) {
                              return queryInterface.createTable('Books', {
                                id: {
                                  allowNull: false,
                                  autoIncrement: true,
                          Severity: Minor
                          Found in server/migrations/20170821170952-create migration for book table.js - About 1 hr to fix

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

                            const BorrowedTable = (props) => {
                              const rows = props.books.length ? props.books.map((book) => {
                                const returned = book.borrowedBook.returned;
                                const bookImage = <img src={(book.cover &&
                                  requestImageUrl(book.cover, { width: 50 })) || BOOK_IMAGE_FALLBACK}
                            Severity: Minor
                            Found in client/components/History/BorrowedTable.jsx - About 1 hr to fix

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

                                createUser(req, res, next) {
                                  delete req.body.isAdmin;
                                  const username = req.body.username;
                                  const email = req.body.email;
                                  return User.find({
                              Severity: Minor
                              Found in server/controllers/UserController.js - About 1 hr to fix

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

                                  passwordResetMail(req, res) {
                                    return User.findOne({
                                      where: { email: req.body.email },
                                      attributes: ['id', 'email'],
                                      plain: true,
                                Severity: Minor
                                Found in server/controllers/UserController.js - About 1 hr to fix

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

                                  const TransactionHistory = (props) => {
                                    const transactions = props.transactions.length ?
                                      props.transactions.map(
                                        transaction => (
                                          <Col s={12}
                                  Severity: Minor
                                  Found in client/components/History/TransactionHistory.jsx - About 1 hr to fix

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

                                      getUser(req, res, next) {
                                        const username = req.body.username;
                                        const password = req.body.password;
                                        return User.findOne({ where: { username } }).then((user) => {
                                          if (!user) {
                                    Severity: Minor
                                    Found in server/controllers/UserController.js - About 1 hr to fix

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

                                        returnBook(req, res, next) {
                                          const bookId = req.body.id;
                                          const userId = req.params.id;
                                          BorrowedBook.findOne({ where: { userId, bookId, returned: false } })
                                            .then((borrowedBook) => {
                                      Severity: Minor
                                      Found in server/controllers/BookController.js - About 1 hr to fix

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

                                          render() {
                                            let navLinks = ['library'];
                                            navLinks = this.props.isLoggedIn ?
                                              ['dashboard', ...navLinks, 'history', 'logout'] :
                                              ['login', 'sign up', ...navLinks];
                                        Severity: Minor
                                        Found in client/components/Header/index.jsx - About 1 hr to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language