timi-codes/Banka

View on GitHub

Showing 15 of 58 total issues

File dashboard.js has 445 lines of code (exceeds 300 allowed). Consider refactoring.
Open

const accountModal = document.getElementById('accountModal');
const account = document.getElementById('account-button');
const profileModal = document.getElementById('profileModal');
const profile = document.getElementById('profile-button');
const baseUrl = 'https://banka-timi.herokuapp.com/api/v1';
Severity: Minor
Found in frontend/js/dashboard.js - About 5 hrs to fix

    File customer.js has 339 lines of code (exceeds 300 allowed). Consider refactoring.
    Open

    const accountModal = document.getElementById("accountModal");
    const body = document.getElementsByTagName("body")[0];
    const baseUrl = "https://banka-timi.herokuapp.com/api/v1";
    const content = document.querySelector(".content");
    const tableDiv = document.querySelectorAll(".tableDiv");
    Severity: Minor
    Found in frontend/js/customer.js - About 2 hrs to fix

      Function successLogic has 56 lines of code (exceeds 30 allowed). Consider refactoring.
      Open

      const successLogic = data => {
      if (data.data.length > 0) {
      tableDiv[0].style.display = "block";
      if (credit) {
      credit.style.visibility = "visible";
      Severity: Major
      Found in frontend/js/customer.js - About 2 hrs to fix

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

        trasactButton.onclick = () => {
        if (amountTextField.value === "" || amountTextField.value === null) {
        errorTag[0].innerHTML = "Enter an amount";
        } else if (!amountTextField.value.match(/^\d+(\.\d{1,2})?$/)) {
        errorTag[0].innerHTML = "Enter a valid amount";
        Severity: Major
        Found in frontend/js/customer.js - About 1 hr to fix

          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

                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

                  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

                      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

                      Function search has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
                      Open

                      const search = () => {
                      var input, filter, tr, td, i, txtValue;
                      input = document.getElementById("searchInput");
                      filter = input.value.toUpperCase();
                      tr = accountTable.getElementsByTagName("tr");
                      Severity: Minor
                      Found in frontend/js/dashboard.js - About 25 mins to fix

                      Function onclick has a Cognitive Complexity of 7 (exceeds 6 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 25 mins to fix

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

                      trasactButton.onclick = () => {
                      if (amountTextField.value === "" || amountTextField.value === null) {
                      errorTag[0].innerHTML = "Enter an amount";
                      } else if (!amountTextField.value.match(/^\d+(\.\d{1,2})?$/)) {
                      errorTag[0].innerHTML = "Enter a valid amount";
                      Severity: Minor
                      Found in frontend/js/customer.js - About 25 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language