File dashboard.js
has 445 lines of code (exceeds 300 allowed). Consider refactoring.
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';
File customer.js
has 339 lines of code (exceeds 300 allowed). Consider refactoring.
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");
Function successLogic
has 56 lines of code (exceeds 30 allowed). Consider refactoring.
const successLogic = data => {
if (data.data.length > 0) {
tableDiv[0].style.display = "block";
if (credit) {
credit.style.visibility = "visible";
Function onclick
has 52 lines of code (exceeds 30 allowed). Consider refactoring.
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";
Function onclick
has 50 lines of code (exceeds 30 allowed). Consider refactoring.
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';
Function onclick
has 50 lines of code (exceeds 30 allowed). Consider refactoring.
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';
Function onclick
has 45 lines of code (exceeds 30 allowed). Consider refactoring.
createAccount.onclick = () => {
if (balanceTextField.value === '' || balanceTextField.value === null) {
balanceTextField.value = 0.00;
} else if (accountType.value === 'default') {
errorTag[0].innerHTML = 'Select an account type';
Function onclick
has 40 lines of code (exceeds 30 allowed). Consider refactoring.
userLogin.onclick = () => {
const loginUrl = `${baseUrl}/auth/signin`;
if (!emailInput.value.match(/\S+@\S+\.\S+/)) {
errorTag[0].innerHTML = 'Enter a valid email address';
Function signUser
has 36 lines of code (exceeds 30 allowed). Consider refactoring.
static async signUser(login) {
try {
const user = await User.findUserByEmail(login.email);
if (user) {
Function changeStatus
has 34 lines of code (exceeds 30 allowed). Consider refactoring.
const changeStatus = (stat, url) => {
fetch(url, {
headers: {
"Content-Type": "application/json",
"x-access-token": `Bearer ${token}`
Function filter
has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring.
const filter = ()=> {
var type, filter, tr, td, i, txtValue;
type = document.querySelector("#filter-trans");
filter = type.value.toUpperCase();
tr = transactionTable.getElementsByTagName("tr");
Function onclick
has a Cognitive Complexity of 9 (exceeds 6 allowed). Consider refactoring.
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';
Function search
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
const search = () => {
var input, filter, tr, td, i, txtValue;
input = document.getElementById("searchInput");
filter = input.value.toUpperCase();
tr = accountTable.getElementsByTagName("tr");
Function onclick
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
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';
Function onclick
has a Cognitive Complexity of 7 (exceeds 6 allowed). Consider refactoring.
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";