betagouv/service-national-universel

View on GitHub

Showing 923 of 941 total issues

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

export default function Field({ onChange, value, label, disabled = false, error, readOnly = false, copy, placeholder }) {
  const [copied, setCopied] = React.useState(false);

  React.useEffect(() => {
    if (copied) {
Severity: Minor
Found in admin/src/scenes/plan-transport/ligne-bus/components/Field.jsx - 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 Modification has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function Modification({ demandeDeModification, getModification }) {
  const [panel, setPanel] = React.useState({ open: false });
  const [tagsOptions, setTagsOptions] = React.useState(null);
  const user = useSelector((state) => state.Auth.user);
  const history = useHistory();

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

export default function Regional() {
  const history = useHistory();

  const user = useSelector((state) => state.Auth.user);
  const cohorts = useSelector((state) => state.Cohorts);
Severity: Minor
Found in admin/src/scenes/plan-transport/table-repartition/RegionalView.jsx - 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 SelectInput has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function SelectInput({ options, onChange, disabled, placeholder, renderOption, value }) {
  const [open, setOpen] = useState(false);
  const [searchValue, setSearchValue] = useState("");
  const ref = React.useRef(null);

Severity: Minor
Found in admin/src/scenes/edit-transport/deplacement/components/SelectInput.jsx - 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 SchemaRepartitionIndex has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function SchemaRepartitionIndex(props) {
  const region = props.match && props.match.params && props.match.params.region;
  const department = props.match && props.match.params && props.match.params.department;

  const user = useSelector((state) => state.Auth.user);
Severity: Minor
Found in admin/src/scenes/plan-transport/schema-repartition/index.jsx - 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 DatePickerList has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function DatePickerList({ value, label, onChange, error = "", disabled = false, readOnly = false, Icon = false }) {
  return (
    <div className={`flex w-full flex-col rounded-lg border-[1px] border-gray-300 py-2 px-2.5 ${disabled ? "bg-gray-100" : ""} ${error ? "border-red-500" : ""}`}>
      <div className="flex w-full items-center gap-x-2">
        {Icon ? <Icon className="h-4 w-4 text-gray-400" /> : null}
Severity: Minor
Found in admin/src/scenes/plan-transport/ligne-bus/components/DatePickerList.jsx - 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 From has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const From = ({ allLines, isDirty, selectedMeetingPoint, setSelectedMeetingPoint, selectedLigne, setSelectedLigne, checkedYoungs, setCheckedYoungs, cohort }) => {
  const [meetingPointsOptions, setMeetingPointsOptions] = useState([]);
  const [meetingPoints, setMeetingPoints] = useState([]);
  const urlParams = new URLSearchParams(window.location.search);
  const [youngsFilter, setYoungsFilter] = useState([]);
Severity: Minor
Found in admin/src/scenes/edit-transport/deplacement/From.jsx - 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 Field has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const Field = ({ onChange, value, label, disabled = false, error, readOnly = false, copy, className = "", eye = null }) => {
  const [copied, setCopied] = React.useState(false);
  const [eyeVisible, setEyeVisible] = React.useState(false);
  React.useEffect(() => {
    if (copied) {
Severity: Minor
Found in admin/src/scenes/profil/index.jsx - 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 DeletedInscriptionPanel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function DeletedInscriptionPanel({ onChange, value }) {
  const [young, setYoung] = useState(null);

  useEffect(() => {
    (async () => {
Severity: Minor
Found in admin/src/scenes/inscription/deletedPanel.jsx - 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 StepsAffected has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function StepsAffected({ data }) {
  const { isCLE, young } = useAuth();
  if (!young) return <div />;

  function handleClick() {
Severity: Minor
Found in app/src/scenes/phase1/scenes/affected/components/StepsAffected.jsx - 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 PDRModal has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function PDRModal({ open, setOpen, meetingPoints, center, session, pdrChoiceExpired }) {
  const young = useSelector((state) => state.Auth.young);
  const cohort = getCohort(young.cohort);
  const dispatch = useDispatch();
  const [modalMeetingPoint, setModalMeetingPoint] = useState({ isOpen: false, meetingPoint: null });
Severity: Minor
Found in app/src/scenes/phase1/scenes/affected/components/modals/PDRModal.jsx - 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 General has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function General({ updateFilter, focusedSession, filterArray, setHasYoungValidated }) {
  const [young, setYoung] = useState();

  //List state
  const pageId = "pointage-list";
Severity: Minor
Found in admin/src/scenes/centersV2/youngs/general.jsx - 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 Programs has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function Programs() {
  const [open, setOpen] = useState(false);
  const { isPending, error, data } = useQuery({ queryKey: ["program"], queryFn: fetchPrograms });

  if (isPending) return <Loader />;
Severity: Minor
Found in app/src/scenes/phase2/scenes/Home/components/Programs.jsx - 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 hasAccessToPhase2 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export function hasAccessToPhase2(young) {
  if (!young) return false;
  if (young.statusPhase2 === "VALIDATED") return true;
  if (young.status === YOUNG_STATUS.WITHDRAWN) return false;
  const userIsDoingAMission = young.phase2ApplicationStatus.some((status) => ["VALIDATED", "IN_PROGRESS"].includes(status));
Severity: Minor
Found in app/src/utils/index.js - 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 Done has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function Done() {
  const { young, isCLE } = useAuth();
  const history = useHistory();
  async function handleClick() {
    try {
Severity: Minor
Found in app/src/scenes/preinscription/Done.jsx - 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 ToutSavoir has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

function ToutSavoir({ data }) {
  const [open, setOpen] = useState(!data.publisherName);

  return (
    <section id="tout-savoir" className="mt-4 rounded-xl border p-3">
Severity: Minor
Found in app/src/scenes/phase2/scenes/Program/index.jsx - 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 MenuItem has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function MenuItem({ to, enabled = true, icon, text, status, onClose, ticketCount }) {
  const isActive = location.pathname.includes(to) && (to !== "/" || location.pathname === "/");

  if (enabled) {
    return (
Severity: Minor
Found in app/src/components/layout/navbar/components/MenuLink.jsx - 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 Index has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

export default function Index() {
  const young = useSelector((state) => state.Auth.young);
  const [infosHover, setInfosHover] = useState(false);
  const [infosClick, setInfosClick] = useState(false);
  const toggleInfos = () => {
Severity: Minor
Found in app/src/scenes/phase3/valider/index.jsx - 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 Account has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const Account = () => {
  useDocumentTitle("Mon profil");
  const { young } = useAuth();

  const ACCOUNT_PAGES = {
Severity: Minor
Found in app/src/scenes/account/index.jsx - 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 AccountSchoolSituationPage has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

const AccountSchoolSituationPage = () => {
  const { young, isCLE } = useAuth();
  const {
    isPending,
    isError,
Severity: Minor
Found in app/src/scenes/account/scenes/school-situation/index.jsx - 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