betagouv/service-national-universel

View on GitHub

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 = [
Severity: Minor
Found in admin/src/scenes/volontaires/components/phase1/DocumentPhase1.jsx - About 2 hrs to fix

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);
Severity: Minor
Found in admin/src/components/ui/forms/dateForm/DatePickerInput.jsx - About 2 hrs to fix

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);
Severity: Minor
Found in admin/src/components/ui/forms/SimpleSelect.jsx - About 2 hrs to fix

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;
Severity: Minor
Found in admin/src/scenes/dashboardV2/components/sejour/StatusPhase1.jsx - About 2 hrs to fix

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 });
Severity: Minor
Found in admin/src/components/selectStatusMission.jsx - About 2 hrs to fix

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 });
Severity: Minor
Found in admin/src/scenes/missions/components/SelectStatusMissionV2.jsx - About 2 hrs to fix

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);
Severity: Minor
Found in admin/src/scenes/plan-transport/schema-repartition/SchemaEditor.jsx - About 2 hrs to fix

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);
Severity: Minor
Found in admin/src/scenes/inscription/panel.jsx - About 2 hrs to fix

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);
Severity: Minor
Found in app/src/scenes/preinscription/components/ModifyEmailModal.jsx - About 2 hrs to fix

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";
Severity: Minor
Found in app/src/components/buttons/ModalButton.jsx - About 2 hrs to fix

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);

Severity: Minor
Found in admin/src/scenes/centersV2/components/modals/ModalTimeSchedule.jsx - About 2 hrs to fix

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();

Severity: Minor
Found in app/src/scenes/contact/components/ContactForm.jsx - About 2 hrs to fix

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);

Severity: Minor
Found in admin/src/scenes/centersV2/components/modals/ModalPedagoProject.jsx - About 2 hrs to fix

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);
Severity: Minor
Found in app/src/scenes/account/components/WithdrawalModal.jsx - About 2 hrs to fix

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;
Severity: Minor
Found in api/src/crons/patch/structure.js - About 2 hrs to fix

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 = {};

Severity: Minor
Found in api/src/crons/dsnjExport/index.js - About 2 hrs to fix

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") || []);

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(),
Severity: Minor
Found in api/src/auth.js - About 2 hrs to fix

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;
Severity: Minor
Found in api/src/controllers/application.js - About 2 hrs to fix

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({});
Severity: Minor
Found in app/src/scenes/inscription2023/steps/stepConfirm.jsx - About 2 hrs to fix

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

Severity
Category
Status
Source
Language