betagouv/service-national-universel

View on GitHub

Showing 927 of 945 total issues

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

export default function CardRepresentant({ structure, setStructure }) {
  const representant = structure?.structureManager || null;
  const [isOpen, setIsOpen] = useState(false);
  const handleShowModal = () => setIsOpen(true);

Severity: Minor
Found in admin/src/scenes/structure/components/cards/CardRepresentant.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 getPages has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export function getPages(lastDisplayItem, firstDisplayPage, lastDisplayPage, itemsCountTotal, lastPage, size) {
  let pages = [];
  if (lastDisplayItem === itemsCountTotal) {
    // derniere page
    for (let i = firstDisplayPage - 1; i <= lastDisplayPage - 1; ++i) pages.push(i);
Severity: Minor
Found in admin/src/utils/pagination.utils.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 ModalChangePresenceJDM has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const ModalChangePresenceJDM = ({ young, value, onConfirm, onLoading, ...rest }) => {
  const [isLoading, setIsLoading] = useState(false);

  const getTitle = () => {
    if (value === "true") return `Marquer ${young.firstName} présent(e) à la JDM`;
Severity: Minor
Found in admin/src/components/modals/young/ModalChangePresenceJDM.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 Hit has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const Hit = ({ hit, onClick }) => {
  const missionsInfo = {
    count: hit.missions ? hit.missions.length : 0,
    placesTotal: hit.missions ? hit.missions.reduce((acc, e) => acc + e.placesTotal, 0) : 0,
  };
Severity: Minor
Found in admin/src/scenes/structure/listV3.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 FullDoughnut has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function FullDoughnut({
  title,
  values,
  valueSuffix,
  labels,
Severity: Minor
Found in admin/src/scenes/dashboardV2/components/graphs/FullDoughnut.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 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 admin/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 _handleArgs has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

  _handleArgs() {
    const args = this._rewriteArgs(process.argv.slice(2));
    if (args.find((i) => i === SHORTCUT + "h" || i === OPTION + "help")) {
      this._logUsageThenExit(0);
      return {};
Severity: Minor
Found in devops/scripts/lib/user-input.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 Profil has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

export default function Profil({ sideBarOpen, user, setOpenInvite }) {
  const [isLoggingOut, setIsLoggingOut] = useState(false);
  const [isPopoverOpen, setPopoverOpen] = useState(false);
  const [from, setFrom] = useState();
  const dispatch = useDispatch();
Severity: Minor
Found in admin/src/components/drawer/components/Profil.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 ModalChangeTravelByPlane has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
Open

const ModalChangeTravelByPlane = ({ young, value, onConfirm, onLoading, ...rest }) => {
  const [isLoading, setIsLoading] = useState(false);

  const getTitle = () => {
    if (value === "true") return `Marquer ${young.firstName} comme voyageant en avion.`;
Severity: Minor
Found in admin/src/components/modals/young/ModalChangeTravelByPlane.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 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 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 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 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 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 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 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 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 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 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

Severity
Category
Status
Source
Language