Showing 923 of 941 total issues
Function Create
has a Cognitive Complexity of 62 (exceeds 5 allowed). Consider refactoring. Open
export default function Create() {
const urlParams = new URLSearchParams(window.location.search);
const user = useSelector((state) => state.Auth.user);
const history = useHistory();
const cohort = urlParams.get("cohort");
- Read upRead up
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
Consider simplifying this complex logical expression. Open
if (young) {
const situationOptions = young.schooled === "true" ? youngSchooledSituationOptions : youngActiveSituationOptions;
setSituationOptions(situationOptions);
if (young.handicap === "true" || young.allergies === "true" || young.ppsBeneficiary === "true" || young.paiBeneficiary === "true") {
Function View
has 415 lines of code (exceeds 200 allowed). Consider refactoring. Open
export default function View(props) {
const history = useHistory();
const user = useSelector((state) => state.Auth.user);
const cohorts = useSelector((state) => state.Auth.user?.cohorts);
Function SelectStatus
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
export default function SelectStatus({ hit, options = Object.keys(YOUNG_STATUS), statusName = "status", phase = YOUNG_PHASE.INSCRIPTION, disabled, callback = () => {} }) {
const [modal, setModal] = useState(null);
const [young, setYoung] = useState(null);
const user = useSelector((state) => state.Auth.user);
const [modalConfirm, setModalConfirm] = useState({ isOpen: false, onConfirm: null });
- Read upRead up
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 Itineraire
has a Cognitive Complexity of 60 (exceeds 5 allowed). Consider refactoring. Open
export default function Itineraire({ meetingsPoints, center, aller, retour, bus, setBus }) {
const [showRetour, setShowRetour] = React.useState(false);
const [timeline, setTimeline] = React.useState([]);
const user = useSelector((state) => state.Auth.user);
- Read upRead up
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
File schema-de-repartition.js
has 1009 lines of code (exceeds 700 allowed). Consider refactoring. Open
/**
* ROUTES:
* GET /schema-de-repartition/export/:cohort => get National groups populated for export
* GET /schema-de-repartition/export/:region/:cohort => get Regional groups populated for export
* GET /schema-de-repartition/export/:region/:department/:cohort => get Department groups populated for export
Function Create
has 409 lines of code (exceeds 200 allowed). Consider refactoring. Open
export default function Create() {
const user = useSelector((state) => state.Auth.user);
const history = useHistory();
const [networks, setNetworks] = useState([]);
const [isLoading, setIsLoading] = useState(false);
Function translateFieldYoung
has 407 lines of code (exceeds 200 allowed). Consider refactoring. Open
const translateFieldYoung = (f) => {
switch (f) {
case "firstName":
return "Prénom";
case "lastName":
Function Pointage
has a Cognitive Complexity of 58 (exceeds 5 allowed). Consider refactoring. Open
export default function Pointage({ updateFilter, isYoungCheckinOpen, focusedSession, filterArray, setHasYoungValidated }) {
const history = useHistory();
const [young, setYoung] = useState();
const [youngSelected, setYoungSelected] = useState([]);
const [youngsInPage, setYoungsInPage] = useState([]);
- Read upRead up
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
Similar blocks of code found in 2 locations. Consider refactoring. Open
const PHONE_ZONES = {
FRANCE: {
shortcut: "FR",
name: "France métropolitaine",
code: "+33",
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 471.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
describe("GET /toRegion/:cohort/:region", () => {
it("should return 200 and data when request is valid and user can view tableDeRepartition", async () => {
// Define a mock table de répartition object
const mockTableDeRepartition = {
_id: "mockId",
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 471.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
describe("GET /fromRegion/:cohort/:region", () => {
it("should return 200 and data when request is valid and user can view tableDeRepartition", async () => {
// Define a mock table de répartition object
const mockTableDeRepartition = {
_id: "mockId",
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 471.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
const PhoneZones: Record<string, TPhoneZone> = {
FRANCE: {
shortcut: "FR",
name: "France métropolitaine",
code: "+33",
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 471.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Function ViewMobile
has 400 lines of code (exceeds 200 allowed). Consider refactoring. Open
export default function ViewMobile() {
const [mission, setMission] = useState();
const [modal, setModal] = useState(null);
const [loading, setLoading] = useState(false);
const [currentTab, setCurrentTab] = useState("mots");
Function View
has a Cognitive Complexity of 57 (exceeds 5 allowed). Consider refactoring. Open
export default function View(props) {
const history = useHistory();
const user = useSelector((state) => state.Auth.user);
const cohorts = useSelector((state) => state.Auth.user?.cohorts);
- Read upRead up
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
File index.jsx
has 983 lines of code (exceeds 700 allowed). Consider refactoring. Open
import Img2 from "../../assets/logo-snu.png";
import React, { useState, useEffect } from "react";
import { useHistory } from "react-router-dom";
import { toastr } from "react-redux-toastr";
import styled from "styled-components";
File roles.ts
has 982 lines of code (exceeds 700 allowed). Consider refactoring. Open
import { ReferentDto, UserDto } from "./dto";
import { region2department } from "./region-and-departments";
import { isNowBetweenDates } from "./utils/date";
import { LIMIT_DATE_ESTIMATED_SEATS, LIMIT_DATE_TOTAL_SEATS, STATUS_CLASSE } from "./constants/constants";
import { ClasseType, SessionPhase1Type } from "./mongoSchema";
Function ViewDesktop
has 392 lines of code (exceeds 200 allowed). Consider refactoring. Open
export default function ViewDesktop() {
const [mission, setMission] = useState();
const [modal, setModal] = useState(null);
const [loading, setLoading] = useState(false);
const [contract, setContract] = useState(null);
Function Phase2Application
has a Cognitive Complexity of 55 (exceeds 5 allowed). Consider refactoring. Open
export default function Phase2Application({ young, onChange, currentTab = "candidature" }) {
const [application, setApplication] = React.useState(null);
const [mission, setMission] = React.useState();
const [tags, setTags] = React.useState();
const [contract, setContract] = React.useState(null);
- Read upRead up
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 55 (exceeds 5 allowed). Consider refactoring. Open
export default function Profil() {
useDocumentTitle("Mon profil");
const user = useSelector((state) => state.Auth.user);
const dispatch = useDispatch();
- Read upRead up
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"