uchemukolo/EventManager

View on GitHub

Showing 15 of 15 total issues

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

  up: (queryInterface, Sequelize) => {
    return queryInterface.createTable('Centers', {
      id: {
        allowNull: false,
        autoIncrement: true,
Severity: Minor
Found in server/migrations/20171126143203-create-centers.js - About 1 hr to fix

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

      signup(req, res) {
        const {email, username, firstName, lastName, password, confirmPassword} = req.body;
        Users.find({
          where: {
            $or: [
    Severity: Minor
    Found in server/src/controller/user.js - About 1 hr to fix

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

        up: (queryInterface, Sequelize) => {
          return queryInterface.createTable('Users', {
            id: {
              allowNull: false,
              autoIncrement: true,
      Severity: Minor
      Found in server/migrations/20171126130221-create-user.js - About 1 hr to fix

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

          up: (queryInterface, Sequelize) => {
            return queryInterface.createTable('Events', {
              id: {
                allowNull: false,
                autoIncrement: true,
        Severity: Minor
        Found in server/migrations/20171126160353-create-events.js - About 1 hr to fix

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

            signin(req, res) {
              const { username, email, password, } = req.body;
              Users.findOne({
                where: {
                  $or: [
          Severity: Minor
          Found in server/src/controller/user.js - About 1 hr to fix

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

              add (req, res) {
                const { userId, centerId, eventType, eventDate } = req.body;
                const decoded = jwt.decode(req.headers.token);
                console.log(decoded);
                  events.findAll({
            Severity: Minor
            Found in server/src/controller/event.js - About 1 hr to fix

              Function update has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                update(req, res) {
                  const {userId, name, description, location, capacity, venueType, facilities} = req.body;
                  const Decoded = jwt.decode(req.headers.token);
                  center.findOne({
                    where: {
              Severity: Minor
              Found in server/src/controller/center.js - About 1 hr to fix

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

                    update (req, res) {
                    const { eventType, eventDate, decoded } = req.body;
                    events.findOne({
                      where: {
                        userId: req.decoded.id,
                Severity: Minor
                Found in server/src/controller/event.js - About 1 hr to fix

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

                    signup(req, res, next) {
                      const {username, firstName, lastName, email, password, confirmPassword} = req.body;
                      if (!username || typeof username !== 'string') {
                        return res.status(400).send({
                          username: 'Please Enter Username'
                  Severity: Minor
                  Found in server/src/middlewares/Validations.js - About 1 hr to fix

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

                      addCenter(req, res, next) {
                        const { userId, centerId, name, description, location, capacity, venueType, } = req.body;
                        if (!name || typeof name !== 'string') {
                          res.status(400).send({
                            message: 'Please Add Name Of The Center!'
                    Severity: Minor
                    Found in server/src/middlewares/Validations.js - About 1 hr to fix

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

                        signup(req, res, next) {
                          const {username, firstName, lastName, email, password, confirmPassword} = req.body;
                          if (!username || typeof username !== 'string') {
                            return res.status(400).send({
                              username: 'Please Enter Username'
                      Severity: Minor
                      Found in server/src/middlewares/Validations.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

                      Avoid too many return statements within this function.
                      Open

                            return res.status(400).send({
                              password: 'password does not match'
                            });
                      Severity: Major
                      Found in server/src/middlewares/Validations.js - About 30 mins to fix

                        Avoid too many return statements within this function.
                        Open

                              return res.status(400).send({
                                password: 'Please Enter password'
                              });
                        Severity: Major
                        Found in server/src/middlewares/Validations.js - About 30 mins to fix

                          Avoid too many return statements within this function.
                          Open

                                return res.status(400).send({
                                  password: 'Password is too short!'
                                });
                          Severity: Major
                          Found in server/src/middlewares/Validations.js - About 30 mins to fix

                            Function addCenter has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                            Open

                              addCenter(req, res, next) {
                                const { userId, centerId, name, description, location, capacity, venueType, } = req.body;
                                if (!name || typeof name !== 'string') {
                                  res.status(400).send({
                                    message: 'Please Add Name Of The Center!'
                            Severity: Minor
                            Found in server/src/middlewares/Validations.js - About 25 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