Showing 923 of 941 total issues
Function DocumentPhase1
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function DocumentPhase1(props) {
const [young, setYoung] = useState(props.young);
const [statusCohesionStayMedical, setStatusCohesionStayMedical] = useState(getStatusCohesionStayMedical(props.young));
const [loading, setLoading] = useState(false);
const medicalFileOptions = [
- 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 DatePickerWrapper
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function DatePickerWrapper({ label, value, onChange, disabled = false, error, mode, isTime, placeholder, readOnly = false, className }) {
const [time, setTime] = useState(value ? `${String(dayjs(value).utc().hour()).padStart(2, 0)}:${String(dayjs(value).utc().minute()).padStart(2, 0)}` : "00:00");
useEffect(() => {
handleChange(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 SimpleSelect
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function SimpleSelect({ value, transformer, options, onChange, filterOnType, showBackgroundColor = true, allowCustomValue = false }) {
const [selectOptionsOpened, setSelectOptionsOpened] = useState(false);
const [filter, setFilter] = useState("");
const [filteredOptions, setFilteredOptions] = useState([]);
const [inputHasFocus, setInputHasFocus] = 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 StatusPhase1
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function StatusPhase1({ statusPhase1, total, filter, role, sessionId, centerId }) {
const WAITING_AFFECTATION = statusPhase1?.WAITING_AFFECTATION || 0;
const AFFECTED = statusPhase1?.AFFECTED || 0;
const DONE = statusPhase1?.DONE || 0;
const NOT_DONE = statusPhase1?.NOT_DONE || 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 SelectStatusMission
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function SelectStatusMission({ hit, options = [], callback = () => {} }) {
const [waitingCorrectionModal, setWaitingCorrectionModal] = useState(false);
const [refusedModal, setRefusedModal] = useState(false);
const [mission, setMission] = useState(null);
const [modal, setModal] = 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 SelectStatusMissionV2
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function SelectStatusMissionV2({ hit, options = [], callback = () => {} }) {
const [waitingCorrectionModal, setWaitingCorrectionModal] = useState(false);
const [refusedModal, setRefusedModal] = useState(false);
const [mission, setMission] = useState(null);
const [modal, setModal] = 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 SchemaEditor
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function SchemaEditor({ className = "", onExportDetail, department, region, cohortName, groups, summary, onChange, user }) {
const [selectedGroup, setSelectedGroup] = useState(null);
const [isUserAuthorizedToExportData, setIsUserAuthorizedToExportData] = useState(false);
const [isUserAuthorizedToCreateGroup, setIsUserAuthorizedToCreateGroup] = useState(false);
const [exportLoading, setExportLoading] = 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 InscriptionPanel
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function InscriptionPanel({ onChange, value }) {
const [young, setYoung] = useState(null);
const [isConfirmDeleteModalOpen, setIsConfirmDeleteModalOpen] = useState(false);
const history = useHistory();
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
Function ModifyEmailModal
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const ModifyEmailModal = () => {
const [email, setEmail] = useState("");
const [emailConfirmation, setEmailConfirmation] = useState("");
const [error, setError] = useState({});
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 ModalButton
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function ModalButton({ primary, secondary, loading, children, disabled, ...rest }) {
const getBackgroundColor = () => {
if (disabled) return colors.grey;
if (primary) return colors.purple;
if (secondary) return "#ffffff";
- 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 DropZone
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function DropZone({ session, setSession, className = "" }) {
const [dragActive, setDragActive] = useState(false);
const [uploading, setUploading] = useState(false);
const [error, setError] = 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 ContactForm
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function ContactForm({ category, question, parcours }) {
const { young } = useAuth();
const history = useHistory();
const { files, addFiles, deleteFile, error } = useFileUpload();
- 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 DropZone
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
function DropZone({ session, setSession, className = "" }) {
const [dragActive, setDragActive] = useState(false);
const [uploading, setUploading] = useState(false);
const [error, setError] = 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 WithdrawalModal
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const WithdrawalModal = ({ isOpen, onCancel: onCancelProps, young }) => {
const history = useHistory();
const dispatch = useDispatch();
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 processPatch
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async function processPatch(patch, count, total) {
try {
result.structurePatchScanned = result.structurePatchScanned + 1 || 1;
const structure = await StructureModel.findById(patch.ref.toString());
if (!structure) return;
- 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 handler
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
exports.handler = async () => {
try {
const cohorts = await CohortModel.find({});
const exportsGenerated = {};
- 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 KnowledgeBasePublicSection
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const KnowledgeBasePublicSection = ({ item, isRoot, isLoading, device }) => {
const { restriction } = useUser();
const router = useRouter();
const [sections, setSections] = useState(item?.children?.filter((c) => c.type === "section") || []);
const [articles, setArticles] = useState(item?.children?.filter((c) => c.type === "article") || []);
- 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 signupCLE
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
async signupCLE(req, res) {
try {
let schema = {
email: Joi.string().lowercase().trim().email().required(),
phone: Joi.string().trim().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
Function canUpdateApplication
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
const canUpdateApplication = async (user, application, young, structures) => {
// - admin can update all applications
// - referent can update applications of their department/region
// - responsible and supervisor can update applications of their structures
if (user.role === ROLES.ADMIN) return 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 StepConfirm
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
export default function StepConfirm() {
const young = useSelector((state) => state.Auth.young);
const [modal, setModal] = React.useState({ isOpen: false });
const [loading, setLoading] = React.useState(false);
const [error, setError] = 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"