Showing 923 of 941 total issues
Function Phase2militaryPrepartionV2
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
export default function Phase2militaryPrepartionV2({ young }) {
const optionsStatus = ["WAITING_CORRECTION", "REFUSED", "VALIDATED"];
const [applicationsToMilitaryPreparation, setApplicationsToMilitaryPreparation] = useState(null);
const [modal, setModal] = useState({ isOpen: false, template: null, data: null });
const [modalFiles, setModalFiles] = useState({ isOpen: 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 Historic
has a Cognitive Complexity of 42 (exceeds 5 allowed). Consider refactoring. Open
export default function Historic() {
const [loading, setLoading] = useState(false);
const user = useSelector((state) => state.Auth.user);
const urlParams = new URLSearchParams(window.location.search);
const [cohort, setCohort] = useState(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
Similar blocks of code found in 2 locations. Consider refactoring. Open
it("should update classe.status to OPEN if type === CLE && inscriptionStartDate", async () => {
// @ts-ignore
const previous = passport.user.subRole;
// @ts-ignore
passport.user.subRole = "god";
- 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 418.
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
it("should update classe.status to Close if type === CLE && inscriptionEndDate", async () => {
// @ts-ignore
const previous = passport.user.subRole;
// @ts-ignore
passport.user.subRole = "god";
- 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 418.
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 List
has a Cognitive Complexity of 41 (exceeds 5 allowed). Consider refactoring. Open
export default function List() {
const user = useSelector((state) => state.Auth.user);
const [missions, setMissions] = useState();
const [panel, setPanel] = 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
Identical blocks of code found in 2 locations. 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) {
- 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 264.
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
function createFolderView(context, imports) {
// --- prepare elements
const components = [];
const title = `<div className="${titleClass}">${context.title}</div>`;
for (const item of context.components) {
- 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 264.
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 DocumentsPM
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
export default function DocumentsPM({ docRef = null, showHelp = true }) {
const young = useSelector((state) => state.Auth.young);
const [modalDocument, setModalDocument] = React.useState({ isOpen: false });
const [modalInform, setModalInform] = React.useState({ isOpen: false });
const [open, setOpen] = React.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 ChangeAddressModal
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
const ChangeAddressModal = ({ onClose, isOpen, young }) => {
const currentCohort = getCohort(young?.cohort);
const [newCohortName, setNewCohortName] = useState();
const [newAddress, setNewAddress] = useState();
const [step, setStep] = useState(changeAddressSteps.CONFIRM);
- 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 StepProfil
has a Cognitive Complexity of 40 (exceeds 5 allowed). Consider refactoring. Open
export default function StepProfil() {
const { young, isCLE } = useAuth();
const history = useHistory();
const { step } = useParams();
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"
Further reading
Function Coordonnees
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
function Coordonnees({ values, handleChange, setFieldValue, errors }) {
const [liveInFrance, setLiveInFrance] = React.useState(true);
React.useEffect(() => {
loadCountries();
- 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 ModalAffectations
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
export default function ModalAffectations({ isOpen, onCancel, young, center = null, sessionId = null, cohort }) {
const [modal, setModal] = useState({ isOpen: false, message: "", onConfirm: () => {} });
const [session, setSession] = useState(null);
const [step, setStep] = useState(1);
const [pdrOption, setPdrOption] = 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 SectionIdentite
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
export default function SectionIdentite({ young, cohort, onStartRequest, currentRequest, onCorrectionRequestChange, requests, globalMode, onChange, readonly = false }) {
const [sectionMode, setSectionMode] = useState(globalMode);
const [data, setData] = useState(filterDataForYoungSection(young, "identite"));
const [saving, setSaving] = useState(false);
const birthDate = getBirthDate();
- 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 GroupEditor
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
export default function GroupEditor({ group, className = "", onChange, isUserAuthorizedToCreateGroup }) {
const { user } = useSelector((state) => state.Auth);
const [step, setStep] = useState(group._id ? (!isUserAuthorizedToCreateGroup ? GROUPSTEPS.AFFECTATION_SUMMARY : GROUPSTEPS.MODIFICATION) : GROUPSTEPS.CREATION);
const [previousStep, setPreviousStep] = useState(null);
const [reloadNextStep, setReloadNextStep] = 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 PaginationServerDriven
has a Cognitive Complexity of 39 (exceeds 5 allowed). Consider refactoring. Open
export default function PaginationServerDriven({ currentPageNumber, setCurrentPageNumber, itemsCountTotal, itemsCountOnCurrentPage, size = 10, setSize }: Props) {
const displayedPages = 3;
const itemsCountMax = 10000;
let itemCountToDisplay = 0;
if (itemsCountTotal > itemsCountMax) itemCountToDisplay = itemsCountMax;
- 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 constants.ts
has 861 lines of code (exceeds 700 allowed). Consider refactoring. Open
const YOUNG_STATUS = {
WAITING_VALIDATION: "WAITING_VALIDATION",
WAITING_CORRECTION: "WAITING_CORRECTION",
REINSCRIPTION: "REINSCRIPTION",
VALIDATED: "VALIDATED",
Function Inscription
has 319 lines of code (exceeds 200 allowed). Consider refactoring. Open
export default function Inscription() {
useDocumentTitle("Inscriptions");
const user = useSelector((state) => state.Auth.user);
const [young, setYoung] = useState(null);
const [classes, setClasses] = useState(null);
Function TeamModal
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
export default function TeamModal({ isOpen, onCancel, team, setTeam, structure }) {
const user = useSelector((state) => state.Auth.user);
const isSupervisor = user.role === ROLES.SUPERVISOR && user.structureId === structure._id;
const [responsible, setResponsible] = useState(null);
const [isLoading, setIsLoading] = 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 Index
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
export default function Index() {
const user = useSelector((state) => state.Auth.user);
const [isPrepaMilitary, setIsPrepaMilitary] = useState(false);
const [structureId, setStructureId] = 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 MissionsStatuts
has a Cognitive Complexity of 38 (exceeds 5 allowed). Consider refactoring. Open
export default function MissionsStatuts({ filters, missionFilters, className = "" }) {
const [loading, setLoading] = useState(true);
const [error, setError] = useState(null);
const [statuses, setStatuses] = useState([]);
const [exportFilter, setExportFilter] = 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"