betagouv/service-national-universel

View on GitHub

Showing 923 of 941 total issues

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

export function ConfirmModalContent({ source, isGoalReached, isLCavailable, isDatePassed, young }: ConfirmModalContentProps) {
  const modalContent: ConfirmModalContentData = {
    icon: <ShieldCheck className="h-[36px] w-[36px] text-[#D1D5DB]" />,
    title: "",
    message: `Souhaitez-vous confirmer l'action ?`,
Severity: Minor
Found in admin/src/scenes/phase0/components/ConfirmModalContent.tsx - 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

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

export const canUpdateCohort = (cohort?: CohortDto, user?: UserDto | ReferentDto): boolean => {
  if (!user) return false;
  if (!cohort) return true;

  return (
Severity: Minor
Found in packages/lib/src/cohort/cohortService.ts - 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

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

export const mapAppelAProjetDemarcheSimplifieeDtoToAppelAProjet = (appelAProjetDto: DemarcheSimplifieeDto, appelAProjetOptions: IAppelAProjetOptions): IAppelAProjet[] => {
  return appelAProjetDto.data.demarche.dossiers.nodes.map((formulaire) => {
    const etablissement: IAppelAProjet["etablissement"] = {} as IAppelAProjet["etablissement"];
    const referentEtablissement: IAppelAProjet["referentEtablissement"] = {} as IAppelAProjet["referentEtablissement"];
    const classe: IAppelAProjet["classe"] = {} as IAppelAProjet["classe"];
Severity: Minor
Found in api/src/providers/demarcheSimplifiee/demarcheSimplifieeProvider.ts - 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