betagouv/service-national-universel

View on GitHub
api/src/utils/validator.ts

Summary

Maintainability
C
7 hrs
Test Coverage

Function validateYoung has 270 lines of code (exceeds 200 allowed). Consider refactoring.
Open

export function validateYoung(young: YoungDto, user?: UserDto) {
  const keys = {
    firstName: Joi.string().allow(null, ""),
    lastName: Joi.string().allow(null, ""),
    frenchNationality: Joi.string().allow(null, ""),
Severity: Major
Found in api/src/utils/validator.ts - About 3 hrs to fix

    File validator.ts has 764 lines of code (exceeds 700 allowed). Consider refactoring.
    Open

    import Joi from "joi";
    import { ROLES_LIST, SUB_ROLES_LIST, VISITOR_SUB_ROLES_LIST, PHONE_ZONES_NAMES_ARR, UserDto, YoungDto } from "snu-lib";
    import { isYoung } from "../utils";
    
    // Source: https://github.com/mkg20001/joi-objectid/blob/71b2a8c0ccd31153e4efd3e7c10602b4385242f6/index.js#L12
    Severity: Major
    Found in api/src/utils/validator.ts - About 3 hrs to fix

      There are no issues that match your filters.

      Category
      Status