betagouv/service-national-universel

View on GitHub

Showing 923 of 941 total issues

Function Hit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const Hit = ({ hit, onClick }) => {
  return (
    <tr onClick={onClick} className="border-b-[1px] border-y-gray-100 hover:bg-gray-50">
      <td className="pl-4 py-3 w-[30%]">
        <span className="font-bold text-gray-900 leading-6">{hit.status !== "DELETED" ? `${hit.firstName} ${hit.lastName}` : "Compte supprimé"}</span>
Severity: Minor
Found in admin/src/scenes/volontaires/list.jsx - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function List() {
  const user = useSelector((state) => state.Auth.user);
  const cohorts = useSelector((state) => state.Cohorts);

  const [data, setData] = React.useState([]);
Severity: Minor
Found in admin/src/scenes/school/List.jsx - About 35 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 GroupYoungVolumeEditor has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function GroupYoungVolumeEditor({ value, className = "", onChange, availableVolume }) {
  function decrement() {
    if (parseInt(value) > 1) {
      onChange && onChange(parseInt(value) - 1);
    }

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 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function List({ open, setOpen, busId }) {
  const user = useSelector((state) => state.Auth.user);
  const [demandeDeModification, setDemandeDeModification] = React.useState([]);
  const [loading, setLoading] = React.useState(false);
  const history = useHistory();
Severity: Minor
Found in admin/src/scenes/plan-transport/ligne-bus/modificationPanel/List.jsx - About 35 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 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function Index() {
  const user = useSelector((state) => state.Auth.user);
  const cohorts = useSelector((state) => state.Cohorts);

  //useStates
Severity: Minor
Found in admin/src/scenes/dashboardV2/moderator-ref/subscenes/sejour/index.jsx - About 35 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 Hit has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const Hit = ({ hit, selectedCohorts, onClick }) => {
  if (!hit) return <div></div>;
  return (
    <div onClick={onClick} className="flex cursor-pointer items-center border-t-[1px] border-gray-100 py-3 px-4 hover:bg-gray-50">
      <div className="flex w-[30%] flex-col gap-1">
Severity: Minor
Found in admin/src/scenes/centersV2/ListPresence.jsx - About 35 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 Create has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function Create(props) {
  const { files, addFiles, deleteFile, error } = useFileUpload();
  const [isLoading, setLoading] = useState(false);
  const history = useHistory();
  const user = useSelector((state) => state.Auth.user);
Severity: Minor
Found in admin/src/scenes/support-center/ticket/create.jsx - About 35 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 computeYoungStatuses has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

async function computeYoungStatuses(filter) {
  const youngs = await api.post("/elasticsearch/young/aggregate-status/export", {
    filters: filter,
  });
  let lines = [];

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 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function List({ data }) {
  const [currentTab, setCurrentTab] = useState(null);
  const [viewData, setViewData] = useState(null);
  const [filter, setFilter] = useState();
  const [activeStatus, setActiveStatus] = useState([]);
Severity: Minor
Found in admin/src/scenes/session-phase1/view/List.jsx - About 35 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 MobileList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function MobileList({ data }) {
  const [currentTab, setCurrentTab] = useState(null);
  const [viewData, setViewData] = useState(null);
  const [filter, setFilter] = useState();
  const [activeStatus, setActiveStatus] = useState([]);
Severity: Minor
Found in admin/src/scenes/session-phase1/view/MobileList.jsx - About 35 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 InfoDepartement has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function InfoDepartement({ department }) {
  const [servicesDep, setServicesDep] = useState();
  const [contacts, setContacts] = useState();
  const [representant, setRepresentant] = useState();

Severity: Minor
Found in admin/src/scenes/team/components/InfoDepartment.jsx - About 35 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 formatRate has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function formatRate(value, total, fractionDigit = 0, allowMoreThan100 = false) {
  if (total === 0 || total === undefined || total === null || value === undefined || value === null) {
    return "-";
  } else {
    if (value > total && !allowMoreThan100) {
Severity: Minor
Found in admin/src/scenes/plan-transport/util.jsx - About 35 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 EngagementList has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export function EngagementList() {
  const { young } = useSelector((state) => state.Auth);
  const applications = useQuery({ queryKey: ["application"], queryFn: () => fetchApplications(young._id) });
  const equivalences = useQuery({ queryKey: ["equivalence"], queryFn: () => fetchEquivalences(young._id) });

Severity: Minor
Found in app/src/scenes/phase2/scenes/Home/components/EngagementList.jsx - About 35 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 FormRepresentant has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const FormRepresentant = ({ i, data, setData, errors, corrections }) => {
  return (
    <div className="my-4 flex flex-col">
      <div className="pb-2 font-bold text-[18px] text-[#161616]">Représentant légal {i} </div>
      <div className="pl-3 border-l-4 border-l-indigo-500 text-[#3A3A3A] text-[16px] my-4 leading-6">
Severity: Minor
Found in app/src/scenes/inscription2023/steps/stepRepresentants.jsx - About 35 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 Header has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const Header = ({ title }) => {
  const { isCLE, isLoggedIn, loginOrLogout } = useAuth();
  const isInscription = location.pathname.includes("inscription");

  const quickAccessItems = [
Severity: Minor
Found in app/src/components/dsfr/layout/Header.jsx - About 35 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 createFolderView has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

function createFolderView(context, imports) {
  // --- prepare elements
  const components = [];
  const title = `<div className="${titleClass}">${context.title}</div>`;
  for (const item of context.components) {
Severity: Minor
Found in app/src/utils/generate-assets-presentation-page.js - About 35 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 AddressSearch has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function AddressSearch({ updateData, label, error }) {
  const [query, setQuery] = useState("");
  const debouncedQuery = useDebounce(query, 300);
  const { results, isError, isPending } = useAddress({ query: debouncedQuery, options: { limit: 10 }, enabled: debouncedQuery.length > 2 });
  const dropdownRef = useRef(null);
Severity: Minor
Found in app/src/components/dsfr/forms/AddressForm/AddressSearch.jsx - About 35 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 ReInscription has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

export default function ReInscription() {
  const [isReinscriptionOpen, setReinscriptionOpen] = useState(false);
  const [isReinscriptionOpenLoading, setReinscriptionOpenLoading] = useState(true);
  const young = useSelector((state) => state.Auth.young);

Severity: Minor
Found in app/src/scenes/reinscription/index.jsx - About 35 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 Checkbox has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

const Checkbox = ({ label = "", className = "", name = "", value = "", useCheckedAsValue = false, onChange = () => null, error = null, ...rest }) => {
  if ("type" in rest) {
    throw new Error(`Checkbox component cannot handle a custom type.`);
  }

Severity: Minor
Found in app/src/components/forms/inputs/Checkbox.jsx - About 35 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 buildApplicationContext has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

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

  if (!canSearchInElasticSearch(user, "application")) return { applicationContextError: { status: 403, body: { ok: false, code: ERRORS.OPERATION_UNAUTHORIZED } } };

Severity: Minor
Found in api/src/controllers/elasticsearch/utils.js - About 35 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