betagouv/service-national-universel

View on GitHub

Showing 923 of 941 total issues

Function CustomSelect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const CustomSelect = ({ ref = null, onChange, options, value, isMulti = false, placeholder, noOptionsMessage = "Aucune option", error }) => {
  return (
    <ReactSelect
      ref={ref}
      noOptionsMessage={() => noOptionsMessage}
Severity: Minor
Found in admin/src/scenes/volontaires/view/customMission.jsx - About 55 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 CardContacts has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function CardContacts({ contacts, idServiceDep, getService }) {
  const [isOpen, setIsOpen] = useState(false);
  const [sortedContacts, setSortedContacts] = useState({});
  const [nbCohorts, setNbCohorts] = useState(0);
  const [cohorts, setCohorts] = useState([]);
Severity: Minor
Found in admin/src/scenes/team/components/card/CardContacts.jsx - About 55 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 Nav has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function Nav({ filter, updateFilter, currentTab, setCurrentTab }) {
  const user = useSelector((state) => state.Auth.user);
  const [userInTheSameRegion, setUserInTheSameRegion] = useState();

  useEffect(() => {
Severity: Minor
Found in admin/src/scenes/team/components/nav.jsx - About 55 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 CustomSelect has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const CustomSelect = ({ ref = null, onChange, options, value, isMulti = false, placeholder, noOptionsMessage = "Aucune option", error }) => {
  return (
    <ReactSelect
      ref={ref}
      noOptionsMessage={() => noOptionsMessage}
Severity: Minor
Found in admin/src/scenes/missions/create.jsx - About 55 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 PhoneField has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const PhoneField = ({
  name = "",
  label = "Téléphone",
  mode = "readonly",
  value = "",
Severity: Minor
Found in admin/src/scenes/phase0/components/PhoneField.jsx - About 55 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 DesignSystemPage has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function DesignSystemPage() {
  const [values, setValues] = React.useState({
    input1: "",
    input1Phone: "",
    input1PhoneZone: "",
Severity: Minor
Found in admin/src/scenes/develop/DesignSystemPage.jsx - About 55 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 ModalExportMail has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function ModalExportMail({ isOpen, onSubmit, onCancel }) {
  const [isLoading, setIsLoading] = React.useState(false);
  const [emails, setEmails] = React.useState([]);
  const [value, setValue] = React.useState("");
  const [error, setError] = React.useState(false);
Severity: Minor
Found in admin/src/scenes/centersV2/components/modals/ModalExportMail.jsx - About 55 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 SelectAction has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function SelectAction({ options, value, placeholder, Icon = null, alignItems = "left", onChange }) {
  const [open, setOpen] = React.useState(false);
  const [selected, setSelected] = React.useState("");
  const ref = React.useRef(null);

Severity: Minor
Found in admin/src/scenes/session-phase1/components/SelectFilter.jsx - About 55 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 Action has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

const Action = ({ hit, structure, displayActionButton, setResponsable }) => {
  const user = useSelector((state) => state.Auth.user);
  const history = useHistory();
  const [modal, setModal] = useState({ isOpen: false, onConfirm: null });
  const [modalReferentDeleted, setModalReferentDeleted] = useState({ isOpen: false });
Severity: Minor
Found in admin/src/scenes/team/list.jsx - About 55 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 List has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function List() {
  const [responsable, setResponsable] = useState(null);
  const { user, sessionPhase1 } = useSelector((state) => state.Auth);
  const [structures, setStructures] = useState();
  const [services, setServices] = useState();
Severity: Minor
Found in admin/src/scenes/utilisateur/list.jsx - About 55 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 TabSession has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function TabSession({ sessionByCenter, filters }) {
  const [sessionData, setSessionData] = React.useState(null);
  const [isLoading, setIsLoading] = React.useState(true);
  const [page, setPage] = React.useState(0);
  const [pageMax, setPageMax] = React.useState(0);

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

const ChangeEmailModal = ({ onClose, isOpen, young, validationToken = "" }) => {
  const [step, setStep] = useState(changeEmailSteps.ENTER_PASSWORD);
  const [password, setPassword] = useState("");
  const [newEmail, setNewEmail] = 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 DocumentsPhase1 has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function DocumentsPhase1({ young }) {
  const [isMedicalFileModalOpen, setMedicalFileModalOpen] = useState(false);
  const youngStatusPhase1 = getStatusPhase1(young);

  // TODO: find a better way to implement feature flags
Severity: Minor
Found in app/src/scenes/phase1/Files.jsx - About 55 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 IndexPhase2Mobile has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function IndexPhase2Mobile() {
  const young = useSelector((state) => state.Auth.young);
  const [applications, setApplications] = React.useState();
  const [toggleButtonDisplayHidden, setToggleButtonDisplayHidden] = React.useState(false);
  const [loading, setLoading] = React.useState(false);
Severity: Minor
Found in app/src/scenes/candidature/mobile/index.jsx - About 55 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 PageButton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

function PageButton({ page, setCurrentPageNumber, active, lastPage, isLast = false }) {
  const getClass = () => {
    let classTab = [];
    active ? classTab.push("font-bold bg-gray-100 text-gray-900") : classTab.push("font-normal"); // la page est active
    page !== lastPage && !isLast ? classTab.push("border-r border-solid border-gray-200") : null; // page par defaut
Severity: Minor
Found in app/src/components/nav/Pagination.jsx - About 55 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 DndFileInput has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function DndFileInput({
  optional,
  value,
  onChange,
  name,
Severity: Minor
Found in app/src/components/dndFileInput.jsx - About 55 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 RoundButton has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function RoundButton({ children, className = "", onClick = () => {}, spinner = false, icon, href, target, rel, mode = "blue", disabled = false }) {
  let color;

  switch (mode) {
    case "grey":
Severity: Minor
Found in app/src/scenes/phase1/components/Buttons.jsx - About 55 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 Signin has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function Signin() {
  const [loading, setLoading] = React.useState(false);
  const [error, setError] = React.useState({});
  const history = useHistory();
  const [token2FA, setToken2FA] = React.useState("");
Severity: Minor
Found in app/src/scenes/auth/desktop/signin2FA.jsx - About 55 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 IndexDesktop has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export default function IndexDesktop() {
  const young = useSelector((state) => state.Auth.young);
  const [applications, setApplications] = React.useState();
  const [toggleButtonDisplayHidden, setToggleButtonDisplayHidden] = React.useState(false);
  const [loading, setLoading] = React.useState(false);
Severity: Minor
Found in app/src/scenes/candidature/desktop/index.jsx - About 55 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 translateError has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

export function translateError(path) {
  const parts = path.split(".");

  const result = translatePart(ERROR_MESSAGES, parts, 0);
  return result || path;
Severity: Minor
Found in app/src/scenes/representants-legaux/commons.js - About 55 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