timi-codes/Banka

View on GitHub

Showing 48 of 58 total issues

Function onclick has 50 lines of code (exceeds 30 allowed). Consider refactoring.
Open

createUser.onclick = () => {
if (!emailInput.value.match(/\S+@\S+\.\S+/)) {
errorTag[0].innerHTML = 'Enter a valid email address';
}else if(firstNameInput.value === '' || firstNameInput.value === null){
errorTag[0].innerHTML = 'First Name is required';
Severity: Minor
Found in frontend/js/dashboard.js - About 1 hr to fix

    Function onclick has 50 lines of code (exceeds 30 allowed). Consider refactoring.
    Open

    signupButton.onclick = () => {
    if (!signupEmailInput.value.match(/\S+@\S+\.\S+/)) {
    errorsTag[0].innerHTML = 'Enter a valid email address';
    }else if(signupFirstNameInput.value === '' || signupFirstNameInput.value === null){
    errorsTag[0].innerHTML = 'First Name is required';
    Severity: Minor
    Found in frontend/js/main.js - About 1 hr to fix

      Function onclick has 45 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

      createAccount.onclick = () => {
      if (balanceTextField.value === '' || balanceTextField.value === null) {
      balanceTextField.value = 0.00;
      } else if (accountType.value === 'default') {
      errorTag[0].innerHTML = 'Select an account type';
      Severity: Minor
      Found in frontend/js/dashboard.js - About 1 hr to fix

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        accountModal.onclick = e => {
        if (e.target !== e.currentTarget) return;
        accountModal.style.display = "none";
        body.classList.remove("stop-scrolling");
        };
        Severity: Major
        Found in frontend/js/customer.js and 4 other locations - About 1 hr to fix
        frontend/js/dashboard.js on lines 23..27
        frontend/js/dashboard.js on lines 35..39
        frontend/js/main.js on lines 30..34
        frontend/js/main.js on lines 37..41

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        profileModal.onclick = (e) => {
        if (e.target !== e.currentTarget) return;
        profileModal.style.display = 'none';
        body.classList.remove('stop-scrolling');
        };
        Severity: Major
        Found in frontend/js/dashboard.js and 4 other locations - About 1 hr to fix
        frontend/js/customer.js on lines 10..14
        frontend/js/dashboard.js on lines 35..39
        frontend/js/main.js on lines 30..34
        frontend/js/main.js on lines 37..41

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        signupModal.onclick = (e) => {
        if (e.target !== e.currentTarget) return;
        signupModal.style.display = 'none';
        body.classList.remove('stop-scrolling');
        };
        Severity: Major
        Found in frontend/js/main.js and 4 other locations - About 1 hr to fix
        frontend/js/customer.js on lines 10..14
        frontend/js/dashboard.js on lines 23..27
        frontend/js/dashboard.js on lines 35..39
        frontend/js/main.js on lines 37..41

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        loginModal.onclick = (e) => {
        if (e.target !== e.currentTarget) return;
        loginModal.style.display = 'none';
        body.classList.remove('stop-scrolling');
        };
        Severity: Major
        Found in frontend/js/main.js and 4 other locations - About 1 hr to fix
        frontend/js/customer.js on lines 10..14
        frontend/js/dashboard.js on lines 23..27
        frontend/js/dashboard.js on lines 35..39
        frontend/js/main.js on lines 30..34

        Similar blocks of code found in 5 locations. Consider refactoring.
        Open

        accountModal.onclick = (e) => {
        if (e.target !== e.currentTarget) return;
        accountModal.style.display = 'none';
        body.classList.remove('stop-scrolling');
        };
        Severity: Major
        Found in frontend/js/dashboard.js and 4 other locations - About 1 hr to fix
        frontend/js/customer.js on lines 10..14
        frontend/js/dashboard.js on lines 23..27
        frontend/js/main.js on lines 30..34
        frontend/js/main.js on lines 37..41

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        const tableRow = `
        <tr>
        <td>${transaction.type}</td>
        <td>${transaction.accountNumber}</td>
        <td>${date.toDateString()}</td>
        Severity: Major
        Found in frontend/js/dashboard.js and 1 other location - About 1 hr to fix
        frontend/js/customer.js on lines 98..107

        Identical blocks of code found in 2 locations. Consider refactoring.
        Open

        const tableRow = `
        <tr>
        <td>${transaction.type}</td>
        <td>${transaction.accountNumber}</td>
        <td>${date.toDateString()}</td>
        Severity: Major
        Found in frontend/js/customer.js and 1 other location - About 1 hr to fix
        frontend/js/dashboard.js on lines 207..216

        Function onclick has 40 lines of code (exceeds 30 allowed). Consider refactoring.
        Open

        userLogin.onclick = () => {
        const loginUrl = `${baseUrl}/auth/signin`;
         
        if (!emailInput.value.match(/\S+@\S+\.\S+/)) {
        errorTag[0].innerHTML = 'Enter a valid email address';
        Severity: Minor
        Found in frontend/js/main.js - About 1 hr to fix

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          passwordInput.onkeyup = () => {
          if (passwordInput.value === '') {
          passwordLabel.style.display = 'none';
          }
          errorTag[0].innerHTML = '';
          Severity: Major
          Found in frontend/js/main.js and 1 other location - About 1 hr to fix
          frontend/js/main.js on lines 87..92

          Similar blocks of code found in 2 locations. Consider refactoring.
          Open

          emailInput.onkeyup = () => {
          if (emailInput.value === '') {
          emailLabel.style.display = 'none';
          }
          errorTag[0].innerHTML = '';
          Severity: Major
          Found in frontend/js/main.js and 1 other location - About 1 hr to fix
          frontend/js/main.js on lines 94..99

          Function signUser has 36 lines of code (exceeds 30 allowed). Consider refactoring.
          Open

          static async signUser(login) {
          try {
          const user = await User.findUserByEmail(login.email);
           
          if (user) {
          Severity: Minor
          Found in API/services/user.service.js - About 1 hr to fix

            Function changeStatus has 34 lines of code (exceeds 30 allowed). Consider refactoring.
            Open

            const changeStatus = (stat, url) => {
            fetch(url, {
            headers: {
            "Content-Type": "application/json",
            "x-access-token": `Bearer ${token}`
            Severity: Minor
            Found in frontend/js/customer.js - About 1 hr to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              if(account){
              account.onclick = () => {
              accountModal.style.display = 'flex';
              body.classList.add('stop-scrolling');
              };
              Severity: Minor
              Found in frontend/js/dashboard.js and 1 other location - About 55 mins to fix
              frontend/js/customer.js on lines 18..23

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              if (credit) {
              credit.onclick = () => {
              accountModal.style.display = "flex";
              body.classList.add("stop-scrolling");
              };
              Severity: Minor
              Found in frontend/js/customer.js and 1 other location - About 55 mins to fix
              frontend/js/dashboard.js on lines 41..46

              Function filter has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring.
              Open

              const filter = ()=> {
              var type, filter, tr, td, i, txtValue;
              type = document.querySelector("#filter-trans");
              filter = type.value.toUpperCase();
              tr = transactionTable.getElementsByTagName("tr");
              Severity: Minor
              Found in frontend/js/customer.js - About 45 mins to fix

              Function onclick has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring.
              Open

              createUser.onclick = () => {
              if (!emailInput.value.match(/\S+@\S+\.\S+/)) {
              errorTag[0].innerHTML = 'Enter a valid email address';
              }else if(firstNameInput.value === '' || firstNameInput.value === null){
              errorTag[0].innerHTML = 'First Name is required';
              Severity: Minor
              Found in frontend/js/dashboard.js - About 45 mins to fix

              Similar blocks of code found in 2 locations. Consider refactoring.
              Open

              if (nameTextField) {
              nameTextField[0].value = name;
              if (nameTextField[1]) {
              nameTextField[1].value = name;
              }
              Severity: Minor
              Found in frontend/js/dashboard.js and 1 other location - About 40 mins to fix
              frontend/js/dashboard.js on lines 185..190
              Severity
              Category
              Status
              Source
              Language