Showing 15 of 15 total issues
Function up
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Centers', {
id: {
allowNull: false,
autoIncrement: true,
Function signup
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
signup(req, res) {
const {email, username, firstName, lastName, password, confirmPassword} = req.body;
Users.find({
where: {
$or: [
Function up
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Users', {
id: {
allowNull: false,
autoIncrement: true,
Function up
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
up: (queryInterface, Sequelize) => {
return queryInterface.createTable('Events', {
id: {
allowNull: false,
autoIncrement: true,
Function signin
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
signin(req, res) {
const { username, email, password, } = req.body;
Users.findOne({
where: {
$or: [
Function add
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
add (req, res) {
const { userId, centerId, eventType, eventDate } = req.body;
const decoded = jwt.decode(req.headers.token);
console.log(decoded);
events.findAll({
Function update
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
update(req, res) {
const {userId, name, description, location, capacity, venueType, facilities} = req.body;
const Decoded = jwt.decode(req.headers.token);
center.findOne({
where: {
Function update
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
update (req, res) {
const { eventType, eventDate, decoded } = req.body;
events.findOne({
where: {
userId: req.decoded.id,
Function signup
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
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'
Function addCenter
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
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!'
Function signup
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
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'
- Read upRead up
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
Open
return res.status(400).send({
password: 'password does not match'
});
Avoid too many return
statements within this function. Open
Open
return res.status(400).send({
password: 'Please Enter password'
});
Avoid too many return
statements within this function. Open
Open
return res.status(400).send({
password: 'Password is too short!'
});
Function addCenter
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
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!'
- Read upRead up
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"