meetKazuki/QuickCredit

View on GitHub

Showing 7 of 21 total issues

Function createLoan has 61 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  static async createLoan(req, res) {
    const { email } = req.user;
    const { amount, tenor } = req.body;
    const loan = {
      email,
Severity: Major
Found in server/src/controllers/loanController.js - About 2 hrs to fix

    Function getAllLoans has 39 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      static async getAllLoans(req, res) {
        const { status, repaid } = req.query;
        let query;
    
        if (status && repaid) {
    Severity: Minor
    Found in server/src/controllers/loanController.js - About 1 hr to fix

      Function authenticateUser has 35 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      function authenticateUser(userObj, endpoint) {
        const url = `http://localhost:4500/api/v1/auth/${endpoint}`;
        const element = document.querySelector('button[type="submit"]');
        const defaultText = element.textContent;
        let defaultRole = 'user';
      Severity: Minor
      Found in ui/assets/js/authenticateUser.js - About 1 hr to fix

        Function createUser has 31 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          static async createUser(req, res) {
            const {
              firstname, lastname, address, email, password,
            } = req.body;
            const hashedPassword = HelperUtils.hashPassword(password);
        Severity: Minor
        Found in server/src/controllers/userController.js - About 1 hr to fix

          Function postRepayment has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

            static async postRepayment(req, res) {
              const { id } = req.params;
              const paidAmount = parseInt(req.body.paidAmount, 10);
              const query = `SELECT * FROM loans WHERE id='${id}'`;
              let repaid = false;
          Severity: Minor
          Found in server/src/controllers/repaymentController.js - About 1 hr to fix

            Function updateLoan has 28 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              static async updateLoan(req, res) {
                const { id } = req.params;
                const { status } = req.body;
                const query = `SELECT * FROM loans WHERE id='${id}'`;
                const update = `UPDATE loans
            Severity: Minor
            Found in server/src/controllers/loanController.js - About 1 hr to fix

              Function renderLoanRecords has 27 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function renderLoanRecords(recordObj) {
                const list = document.getElementById('record-list');
                const row = document.createElement('tr');
                const {
                  id,
              Severity: Minor
              Found in ui/assets/js/userDashboard.js - About 1 hr to fix
                Severity
                Category
                Status
                Source
                Language