ncutixavier/find-home

View on GitHub
src/validation/houseValidation.js

Summary

Maintainability
A
0 mins
Test Coverage

Showing 0 of 7 total issues

Function houseValidate has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Wontfix

exports.houseValidate = (req, res, next) => {
const houseValidation = Joi.object({
image: Joi.string().required().messages({
"any.required": res.__('image is required'),
"string.empty": res.__('image not empty')
Severity: Minor
Found in src/validation/houseValidation.js - About 1 hr to fix

    Similar blocks of code found in 3 locations. Consider refactoring.
    Wontfix

    bathrooms: Joi.number().min(1).required().messages({
    "any.required": res.__('bathrooms should be required'),
    "number.empty": res.__('bathrooms should not be empty'),
    "number.min": res.__('bathrooms should minimun equal to 1'),
    "any.only": res.__('bathrooms should be number')
    Severity: Major
    Found in src/validation/houseValidation.js and 2 other locations - About 2 hrs to fix
    src/validation/houseValidation.js on lines 15..20
    src/validation/houseValidation.js on lines 22..27

    Similar blocks of code found in 3 locations. Consider refactoring.
    Wontfix

    bedrooms: Joi.number().min(1).required().messages({
    "any.required": res.__('bedrooms should be required'),
    "number.empty": res.__('bedrooms should not be empty'),
    "number.min": res.__('bedrooms should minimun equal to 1'),
    "any.only": res.__('bedrooms should be number number')
    Severity: Major
    Found in src/validation/houseValidation.js and 2 other locations - About 2 hrs to fix
    src/validation/houseValidation.js on lines 22..27
    src/validation/houseValidation.js on lines 29..34

    Similar blocks of code found in 3 locations. Consider refactoring.
    Wontfix

    price: Joi.number().min(5000).required().messages({
    "any.required": res.__('price should be required'),
    "number.empty": res.__('price should not be empty'),
    "number.min": res.__('price should minimun equal to 5000'),
    "any.only": res.__('price should be number number')
    Severity: Major
    Found in src/validation/houseValidation.js and 2 other locations - About 2 hrs to fix
    src/validation/houseValidation.js on lines 15..20
    src/validation/houseValidation.js on lines 29..34

    Similar blocks of code found in 6 locations. Consider refactoring.
    Wontfix

    image: Joi.string().required().messages({
    "any.required": res.__('image is required'),
    "string.empty": res.__('image not empty')
    }),
    Severity: Major
    Found in src/validation/houseValidation.js and 5 other locations - About 55 mins to fix
    src/validation/houseValidation.js on lines 10..13
    src/validation/signinValidation.js on lines 13..18
    src/validation/userValidation.js on lines 5..8
    src/validation/userValidation.js on lines 27..30
    src/validation/userValidation.js on lines 55..58

    Similar blocks of code found in 6 locations. Consider refactoring.
    Wontfix

    location: Joi.string().required().messages({
    "any.required": res.__('location is required'),
    "string.empty": res.__('location not empty')
    }),
    Severity: Major
    Found in src/validation/houseValidation.js and 5 other locations - About 55 mins to fix
    src/validation/houseValidation.js on lines 5..8
    src/validation/signinValidation.js on lines 13..18
    src/validation/userValidation.js on lines 5..8
    src/validation/userValidation.js on lines 27..30
    src/validation/userValidation.js on lines 55..58

    Identical blocks of code found in 4 locations. Consider refactoring.
    Wontfix

    if (result.error) return res.status(400).json({ message: result.error.details[0].message });
    Severity: Major
    Found in src/validation/houseValidation.js and 3 other locations - About 40 mins to fix
    src/validation/signinValidation.js on lines 21..21
    src/validation/userValidation.js on lines 40..40
    src/validation/userValidation.js on lines 75..75

    There are no issues that match your filters.

    Category
    Status