betagouv/service-national-universel

View on GitHub

Showing 923 of 941 total issues

Function HonorCertificate has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function HonorCertificate({ young, cohort }) {
  let cniExpired = false;
  if (young && young.cohort && young.latestCNIFileExpirationDate) {
    const cohortStartingDate = cohort?.dateStart;
    if (cohortStartingDate) {

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 Line has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const Line = ({ hit, onClick, opened, onSelect, selected }) => {
  const [value, setValue] = useState(null);
  const [modalPointageFicheSanitaire, setModalPointageFicheSanitaire] = useState({ isOpen: false });

  useEffect(() => {
Severity: Minor
Found in admin/src/scenes/centersV2/youngs/fiche-sanitaire.jsx - About 1 hr 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 Forgot has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function Forgot() {
  const [done, setDone] = React.useState(false);
  const [email, setEmail] = React.useState("");
  const [loading, setLoading] = React.useState(false);
  const [disabled, setDisabled] = React.useState(true);
Severity: Minor
Found in app/src/scenes/auth/mobile/forgot.jsx - About 1 hr 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 MissionsComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function MissionsComponent() {
  const young = useSelector((state) => state.Auth.young);
  const [filters, setFilters] = React.useState({
    search: "",
    location: {
Severity: Minor
Found in app/src/scenes/phase3/missions.jsx - About 1 hr 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 AccountSpecialSituationsPage has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const AccountSpecialSituationsPage = () => {
  const young = useSelector((state) => state.Auth.young);

  const values = {
    handicap: (young.handicap || "false") === "true" ? true : false,
Severity: Minor
Found in app/src/scenes/account/scenes/special-situations/index.jsx - About 1 hr 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 View has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function View() {
  const { young } = useAuth();
  const phase2NumberHoursDone = young.phase2NumberHoursDone || 0;
  const applications = useQuery({ queryKey: ["application"], queryFn: () => fetchApplications(young._id) });
  const equivalences = useQuery({ queryKey: ["equivalence"], queryFn: () => fetchEquivalences(young._id) });

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 exploreDir has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

async function exploreDir(basedir, dir, relativeDir) {
  const uniqueId = getNextUniqueId();
  let context = {
    title: dir,
    folders: [],
Severity: Minor
Found in app/src/utils/generate-assets-presentation-page.js - About 1 hr 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 AddressDisplay has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function AddressDisplay({ data, updateData, error, correction }) {
  const userIsInInscription = window.location.pathname.includes("inscription");
  const { isCLE } = useAuth();

  function handleClick() {
Severity: Minor
Found in app/src/components/dsfr/forms/AddressForm/AddressDisplay.jsx - About 1 hr 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 ModalPointageDepart has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function ModalPointageDepart({ isOpen, onSubmit, onCancel, young }) {
  const [isLoading, setIsLoading] = React.useState(false);
  const [departSejourMotif, setDepartSejourMotif] = React.useState("");
  const [departSejourAt, setDepartSejourAt] = React.useState("");
  const [departSejourMotifComment, setDepartSejourMotifComment] = React.useState("");

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 Step has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const Step = ({ young: { hasStartedReinscription, reinscriptionStep2023, inscriptionStep2023 } }) => {
  const { step } = useParams();
  const { isCLE } = useAuth();
  const title = isCLE ? "Inscription de l'élève" : "Inscription du volontaire";
  const supportLink = `${supportURL}${isCLE ? "/base-de-connaissance/les-classes-engagees" : "/base-de-connaissance/phase-0-les-inscriptions"}`;
Severity: Minor
Found in app/src/scenes/inscription2023/index.jsx - About 1 hr 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 WaitingReinscription has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function WaitingReinscription({ reinscriptionOpen }) {
  const young = useSelector((state) => state.Auth.young);
  const history = useHistory();

  let textPrecision;
Severity: Minor
Found in app/src/scenes/home/WaitingReinscription.jsx - About 1 hr 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 missingElementsByCohortDepartment has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

service.missingElementsByCohortDepartment = (response, departmentsCohortsFromRepartition, cohorts) => {
  const data = [];
  for (const cohort of cohorts) {
    const cohortDepartments = departmentsCohortsFromRepartition.filter((e) => e.cohort === cohort).map((e) => e.fromDepartment);
    // Chaque département doit avoir un contact pour la cohorte
Severity: Minor
Found in api/src/services/dashboard/todo-sejour.service.js - About 1 hr 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 WaitingValidation has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function WaitingValidation() {
  const { young, isCLE } = useAuth();
  const cohort = getCohort(young.cohort);
  const history = useHistory();
  const dispatch = useDispatch();
Severity: Minor
Found in app/src/scenes/home/waitingValidation.jsx - About 1 hr 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 buildStructureContext has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

async function buildStructureContext(user) {
  const contextFilters = [];

  // A responsible can only see their structure and parent structure (not sure why we need ES though).
  if (user.role === ROLES.RESPONSIBLE) {
Severity: Minor
Found in api/src/controllers/elasticsearch/structure.js - About 1 hr 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 buildClasseContext has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

async function buildClasseContext(user) {
  const contextFilters = [];
  if (await isFeatureAvailable(FeatureFlagName.CLE_BEFORE_JULY_15)) {
    if (user.role !== ROLES.ADMIN) {
      contextFilters.push({ term: { "schoolYear.keyword": "2023-2024" } });
Severity: Minor
Found in api/src/controllers/elasticsearch/cle/classe.js - About 1 hr 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 InfoStructure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const InfoStructure = ({ title, structure }) => {
  const [value, setValue] = useState();
  const [expandNote, setExpandNote] = useState(false);
  useEffect(() => {
    (async () => {
Severity: Minor
Found in app/src/scenes/missions/viewDesktop.jsx - About 1 hr 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 InfoStructure has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const InfoStructure = ({ title, structure }) => {
  const [value, setValue] = useState();
  const [expandNote, setExpandNote] = useState(false);
  useEffect(() => {
    (async () => {
Severity: Minor
Found in app/src/scenes/missions/viewMobile.jsx - About 1 hr 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 FeedbackComponent has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function FeedbackComponent({ item }) {
  const [feedback, setFeedback] = useState({ ...defaultFeedback });
  const [hasSubmitted, setSubmitted] = useState(false);
  const [isSubmitting, setSubmitting] = useState(false);

Severity: Minor
Found in knowledge-base-public/src/components/FeedBack.jsx - About 1 hr 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 render has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

function render(doc, young) {
  let _y;
  const hasParent2 = young.parent2Status !== undefined && young.parent2Status !== null && young.parent2Status.trim().length > 0;
  const allow = young.parent1AllowImageRights === "true" && (!hasParent2 || young.parent2AllowImageRights === "true");

Severity: Minor
Found in api/src/templates/droitImage/droitImage.ts - About 1 hr 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 initPlanTransport has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

async function initPlanTransport(planTransport) {
  const ids = planTransport.lines.reduce(
    (acc, line) => {
      const { "ID CENTRE": centreId, "ID PDR 1": pdr1Id, "ID PDR 2": pdr2Id, "ID PDR 3": pdr3Id } = line;
      if (centreId) acc.centreIds[centreId] = centreId;
Severity: Minor
Found in api/src/__tests__/helpers/PlanDeTransport/planDeTransport.ts - About 1 hr 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