Showing 923 of 941 total issues
Function UserHeader
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function UserHeader({ user, tab, currentUser }) {
const history = useHistory();
const dispatch = useDispatch();
const [handleImpersonateLoading, setHandleImpersonateLoading] = useState(false);
- 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 CniField
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function CniField({
young,
name,
label,
mode,
- 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
Avoid deeply nested control flow statements. Open
if (school) {
changes.schoolName = school.fullName;
changes.schoolType = school.type;
changes.schoolAddress = school.adresse;
changes.schoolZip = school.postcode ? school.postcode : school.codeCity;
Function Section
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function Section({ step, title, editable, collapsable, children, mode, onChangeMode, onSave, onCancel, saving = false, containerNoFlex = false }) {
const [collapsed, setCollapsed] = useState(false);
function startEdit() {
// history.push(`/volontaire/${young._id}/edit`);
- 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
Avoid deeply nested control flow statements. Open
if (onChange) {
changes.schoolName = value;
changes.schoolType = "";
changes.schoolAddress = "";
changes.schoolZip = "";
Function SimpleSelect
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function SimpleSelect({ value, title, transformer, options, onChange, placeholder = "Choisissez une valeur", className = "" }) {
const [selectOptionsOpened, setSelectOptionsOpened] = useState(false);
const selectOptionsRef = useRef();
- 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 ModalPointageFicheSanitaire
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function ModalPointageFicheSanitaire({ isOpen, onSubmit, onCancel, value, young }) {
const [isLoading, setIsLoading] = React.useState(false);
const getTitle = () => `Fiche sanitaire de ${young.firstName} ${value === "true" ? "réceptionnée" : "non réceptionnée"}`;
const getMessage = () => `Vous êtes sur le point d'indiquer que vous ${value === "true" ? "avez reçu" : "n'avez pas reçu"} la fiche sanitaire de ${young.firstName}.`;
- 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 PedagoProjectFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function PedagoProjectFile({ session, setSession, file, className = "" }) {
const [communicating, setCommunicating] = useState(false);
async function deleteFile() {
setCommunicating(true);
- 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 SemiCircleProgress
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export const SemiCircleProgress = ({ current, total }) => {
const progress = (Math.min(current, total) / total) * 100;
return (
<svg className="h-80 pb-8 mx-auto" viewBox="0 0 110 100">
<linearGradient id="gradient" x1="0" y1="0" x2="100%" y2="0%">
- 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 MedicalFileModal
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const MedicalFileModal = ({ isOpen, onClose, onClick, title = "Téléchargez votre fiche sanitaire", email }) => {
const [open, setOpen] = useState(false);
const [loading, setLoading] = useState(false);
const young = useSelector((state) => state.Auth.young);
- 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 Affected
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function Affected() {
const { young } = useAuth();
const [center, setCenter] = useState();
const [meetingPoint, setMeetingPoint] = useState();
const [session, setSession] = 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
Function TimeScheduleFile
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
function TimeScheduleFile({ session, setSession, file, className = "" }) {
const [communicating, setCommunicating] = useState(false);
async function deleteFile() {
setCommunicating(true);
- 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 FileUpload
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
const FileUpload = ({ className, files = [], addFiles, deleteFile, filesAccepted = ["jpeg", "png", "pdf"], disabled = false }) => {
const inputRef = useRef(null);
const accept = Object.keys(FILES_ACCEPTED).reduce((previous, current) => {
if (filesAccepted.includes(current)) {
return `${previous}${previous ? ", " : ""}${FILES_ACCEPTED[current].join(", ")}`;
- 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 Forgot
has a Cognitive Complexity of 8 (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);
- 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 Contact
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function Contact() {
useDocumentTitle("Formulaire de contact");
const { isLoggedIn, young } = useAuth();
const params = new URLSearchParams(window.location.search);
- 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 MultiGroup
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export default function MultiGroup({ onChange = () => {}, className = "", value, options = [] }) {
function onToggle(val) {
if (value) {
const idx = value.indexOf(val);
let newVal = [...value];
- 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 validateEmail
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async validateEmail(req, res) {
try {
const { error, value } = Joi.object({ token_email_validation: Joi.string().required() }).unknown().validate(req.body);
if (error) return res.status(400).send({ ok: false, code: ERRORS.INVALID_BODY });
const { token_email_validation } = value;
- 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 validateUser
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
async function validateUser(Model, jwtPayload, done, role) {
try {
const { error, value } = Joi.object({
__v: Joi.string().required(),
_id: Joi.string().required(),
- 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
Avoid deeply nested control flow statements. Open
if (young.statusPhase2 === YOUNG_STATUS_PHASE2.IN_PROGRESS && application.status === APPLICATION_STATUS.VALIDATED) data.actions.missionInProgress += 1;
Avoid deeply nested control flow statements. Open
if (contract && application.status === APPLICATION_STATUS.VALIDATED) {
const statusContract = checkStatusContract(contract);
if (statusContract === CONTRACT_STATUS.DRAFT) data.actions.contractToBeFilled += 1;
if (statusContract === CONTRACT_STATUS.SENT && contract.structureManagerStatus === "WAITING_VALIDATION") data.actions.contractToBeSigned += 1;
if (statusContract === CONTRACT_STATUS.VALIDATED && young.status === YOUNG_STATUS.VALIDATED) data.actions.volunteerToHost += 1;