Showing 923 of 941 total issues
Function up
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async up() {
const cohorts = await CohortModel.find({}, { name: 1 }).lean();
const cohortsMap = new Map();
for (const cohort of cohorts) {
cohortsMap.set(cohort.name, cohort._id?.toString());
- 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
Function pathToKey
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function pathToKey(path) {
if (path && path.length > 0) {
let key = path[0] === "/" ? path.substring(1) : path;
const idx = key.indexOf("/");
if (idx >= 0) {
- 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
Function getTransportCorrectionRequests
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function getTransportCorrectionRequests(startDate, endDate, user) {
// ref reg and admin
let body = {
query: {
bool: {
- 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
Function ExpirationDate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function ExpirationDate({ date, setDate, onChange, corrections, category }) {
const young = useSelector((state) => state.Auth.young);
const [error, setError] = useState(false);
const handleChange = (date) => {
- 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
Function handler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
exports.handler = async () => {
try {
let countReferents = 0;
// liste des cohortes pour lesquelles on est la veille de la fin de l'instruction
const cohorts = await getCohortsEndingTomorrow();
- 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
Function ExpirationDate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
function ExpirationDate({ corrections, category, young, date, setDate, setHasChanged }) {
const [error, setError] = useState(false);
const handleChange = (date) => {
setDate(date);
setHasChanged(true);
- 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
Function getCcOfYoung
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getCcOfYoung = ({ template, young }) => {
if (!young || !template) return [];
let cc = [];
if (Object.values(SENDINBLUE_TEMPLATES.young).includes(template)) {
if (young.parent1Email && young.parent1FirstName && young.parent1LastName) cc.push({ name: `${young.parent1FirstName} ${young.parent1LastName}`, email: young.parent1Email });
- 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
Function getYoungRegisteredWithParticularSituation
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function getYoungRegisteredWithParticularSituation(startDate, endDate, user) {
// ref reg only
let body = {
query: {
bool: {
- 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
Function validateEmailUpdate
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async validateEmailUpdate(req, res) {
try {
const { error, value } = Joi.object({ token_email_validation: Joi.string().required() }).unknown().validate(req.body);
if (error) return res.status(400).send({ ok: false, code: ERRORS.INVALID_BODY });
const { token_email_validation } = value;
- 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
Function getRegionTableDeRepartition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function getRegionTableDeRepartition(cohort) {
const repartitions = await TableDeRepartitionModel.find({ cohort });
let regions = {};
for (const repartition of repartitions) {
if (regions[repartition.fromRegion] === undefined) {
- 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
Function forgotPasswordReset
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async forgotPasswordReset(req, res) {
const { error, value } = Joi.object({ password: Joi.string().required(), token: Joi.string().min(16).required() })
.unknown()
.validate(req.body);
- 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
Function getTimeScheduleAndPedagoProject
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function getTimeScheduleAndPedagoProject(startDate, endDate, user) {
// ref dep and ref reg
let body = {
query: {
bool: {
- 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
Function getDepartmentTableDeRepartition
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function getDepartmentTableDeRepartition(cohort, region) {
const repartitions = await TableDeRepartitionModel.find({ cohort, fromRegion: region });
let departments = {};
for (const repartition of repartitions) {
if (departments[repartition.fromDepartment] === undefined) {
- 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
Function getProposedMissionsAcceptedOrRefusedByYoung
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
async function getProposedMissionsAcceptedOrRefusedByYoung(startDate, endDate, user) {
// ref dep only
const token = await getAccessToken(config.API_ANALYTICS_ENDPOINT, config.API_ANALYTICS_API_KEY);
let body = {
startDate: formatDateForPostGre(startDate),
- 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
Function buildFilterContext
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
helpers.buildFilterContext = async (user, cohorts, index) => {
// Adding context filter for a special user role :
// 1. create a function which return filter depending index
// 2. add your user role in the first switch case
- 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
Function StatusTable
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export default function StatusTable({ statuses, className = "", onStatusClicked = () => {}, loading = false, nocols = false, colWidth = "w-[45%]" }: Props) {
const columns = nocols
? { left: statuses || [], right: [] }
: statuses
? {
- 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
Function getCohortPeriod
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getCohortPeriod = (cohort, withBold = false) => {
if (!cohort.dateStart || !cohort.dateEnd) return cohort.name || cohort;
if(!shouldDisplayDateByCohortName(cohort.name)) {
return "à venir";
- 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
Function api
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const api = async (path, options: any = {}, force?: boolean) => {
try {
if (!config.ENABLE_SENDINBLUE && !force) {
logger.warn("Not possible to use BREVO api as ENABLE_SENDINBLUE is disabled");
return;
- 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
Function getCohesionCenter
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
const getCohesionCenter = async (young) => {
let cohesionCenter;
let session = await SessionPhase1Model.findById(young.sessionPhase1Id);
let cohesionId = session?.cohesionCenterId || young?.cohesionCenterId;
- 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
Function updateReferentsForMultipleClasses
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
export async function updateReferentsForMultipleClasses(
referentsClassesToUpdate: (UpdateReferentClasse & {
classeId: string;
})[],
user: UserDto,
- 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"