Showing 923 of 941 total issues
File Contract.jsx
has 1500 lines of code (exceeds 700 allowed). Consider refactoring. Open
import Img from "../assets/logo-snu.png";
import React, { useEffect, useState } from "react";
import { Row } from "reactstrap";
import styled from "styled-components";
import { Formik, Field } from "formik";
Function Create
has a Cognitive Complexity of 128 (exceeds 5 allowed). Consider refactoring. Open
export default function Create() {
const history = useHistory();
const location = useLocation();
const [selectedRepresentant, setSelectedRepresentant] = useState(1);
const [loading, setLoading] = 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 StepCoordonnees
has a Cognitive Complexity of 128 (exceeds 5 allowed). Consider refactoring. Open
export default function StepCoordonnees() {
const [wasBornInFrance, setWasBornInFrance] = useState("true");
const [data, setData] = useState(defaultState);
const [errors, setErrors] = useState({});
const [corrections, setCorrections] = 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 DetailsView
has a Cognitive Complexity of 126 (exceeds 5 allowed). Consider refactoring. Open
export default function DetailsView({ mission, setMission, getMission }) {
const [values, setValues] = useState(mission);
const [editing, setEditing] = useState(false);
const [loading, setLoading] = useState(false);
const [errors, setErrors] = 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
<tr className="flex items-center py-3 px-4 hover:bg-gray-50">
<td className="w-[5%]">
<input type="checkbox" className="w-5 h-5 ml-1" checked={selectedYoungs.some((y) => y._id === young._id)} onChange={() => handleSelectYoung(young)} />
</td>
<td className="w-[25%] table-cell truncate cursor-pointer" onClick={() => history.push(`/volontaire/${young._id}`)}>
- 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 687.
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
<tr className="flex items-center py-3 px-4 hover:bg-gray-50">
<td className="w-[5%]">
<input type="checkbox" className="w-5 h-5 ml-1" checked={selectedYoungs.some((y) => y._id === young._id)} onChange={() => handleSelectYoung(young)} />
</td>
<td className="w-[25%] table-cell truncate cursor-pointer" onClick={() => history.push(`/volontaire/${young._id}`)}>
- 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 687.
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 ImageRightsForm
has a Cognitive Complexity of 120 (exceeds 5 allowed). Consider refactoring. Open
function ImageRightsForm({ young, token, parentId }) {
const history = useHistory();
const [errors, setErrors] = useState({});
const [saving, setSaving] = React.useState(false);
const address = getInitialAdress(young, parentId);
- 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 referentController.ts
has 1415 lines of code (exceeds 700 allowed). Consider refactoring. Open
import express, { Response } from "express";
import { logger } from "../logger";
import passport from "passport";
import crypto from "crypto";
import jwt from "jsonwebtoken";
Function StepCoordonnees
has 652 lines of code (exceeds 200 allowed). Consider refactoring. Open
export default function StepCoordonnees() {
const [wasBornInFrance, setWasBornInFrance] = useState("true");
const [data, setData] = useState(defaultState);
const [errors, setErrors] = useState({});
const [corrections, setCorrections] = useState({});
Function StepRepresentants
has a Cognitive Complexity of 117 (exceeds 5 allowed). Consider refactoring. Open
export default function StepRepresentants() {
const young = useSelector((state) => state.Auth.young);
const history = useHistory();
const parent1Keys = ["parent1Status", "parent1FirstName", "parent1LastName"];
const parent2Keys = ["parent2Status", "parent2FirstName", "parent2LastName"];
- 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 Details
has a Cognitive Complexity of 114 (exceeds 5 allowed). Consider refactoring. Open
export default function Details({ user, setUser, currentUser }) {
const [structures, setStructures] = useState([]);
const [sessionOptions, setSessionOptions] = useState([]);
const [sessionsWhereUserIsHeadCenter, setSessionsWhereUserIsHeadCenter] = useState([]);
const [mode, setMode] = useState(MODE_DEFAULT);
- 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 EditEquivalence
has a Cognitive Complexity of 113 (exceeds 5 allowed). Consider refactoring. Open
export default function EditEquivalence() {
const young = useSelector((state) => state.Auth.young);
const keyList = ["type", "desc", "structureName", "address", "zip", "city", "startDate", "endDate", "contactFullName", "contactEmail", "files", "missionDuration"];
const [data, setData] = useState();
const [openType, setOpenType] = 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 SectionParents
has a Cognitive Complexity of 103 (exceeds 5 allowed). Consider refactoring. Open
export default function SectionParents({ young, onStartRequest, currentRequest, onCorrectionRequestChange, requests, globalMode, onChange, oldCohort, readonly }) {
const [currentParent, setCurrentParent] = useState(1);
const [hasSpecificSituation, setHasSpecificSituation] = useState(false);
const [sectionMode, setSectionMode] = useState(globalMode);
const [data, setData] = useState(filterDataForYoungSection(young, "parent"));
- 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
Identical blocks of code found in 2 locations. Consider refactoring. Open
const onSubmit = async () => {
if (loading || disabled) return;
if (password !== confirmPassword) return setError({ text: "Les mots de passe ne correspondent pas" });
setLoading(true);
try {
- 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 469.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
const onSubmit = async () => {
if (loading || disabled) return;
if (password !== confirmPassword) return setError({ text: "Les mots de passe ne correspondent pas" });
setLoading(true);
try {
- 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 469.
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 Create
has 561 lines of code (exceeds 200 allowed). Consider refactoring. Open
export default function Create(props) {
const structureIdFromParams = props?.match?.params?.id;
const urlParams = new URLSearchParams(window.location.search);
const duplicate = urlParams.get("duplicate");
const [values, setValues] = useState({
Function CustomMission
has a Cognitive Complexity of 96 (exceeds 5 allowed). Consider refactoring. Open
export default function CustomMission({ young, onChange }) {
const cohortList = useSelector((state) => state.Cohorts);
const history = useHistory();
const [values, setValues] = useState({
status: "VALIDATED",
- 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 translation.ts
has 1239 lines of code (exceeds 700 allowed). Consider refactoring. Open
import { FUNCTIONAL_ERRORS } from "./constants/functionalErrors";
const translate = (value) => {
switch (value) {
case "WAITING_REALISATION":
Function Index
has a Cognitive Complexity of 93 (exceeds 5 allowed). Consider refactoring. Open
export default function Index() {
const [context, setContext] = useState(null);
const history = useHistory();
const token = new URLSearchParams(window.location.search).get("token");
- 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
<div className="border-t-solid border-t-[1px] border-t-[#E5E5E5] py-[20px]">
<div className="flex items-center">
<div className="flex-grow-1">
<b>Je réside</b> {formattedAddress}
</div>
- 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 587.
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