NMDSdevopsServiceAdm/SopraSteria-SFC

View on GitHub

Showing 3,465 of 3,465 total issues

File worker.js has 1456 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*
* worker.js
*
* The encapsulation of a Worker, including all properties, all specific validation (not API, but object validation),
* saving & restoring of data to database (via sequelize model), construction and deletion.
Severity: Major
Found in backend/server/models/classes/worker.js - About 3 days to fix

    WorkerCsvValidator has 178 functions (exceeds 20 allowed). Consider refactoring.
    Open

    class WorkerCsvValidator {
    constructor(currentLine, lineNumber, currentWorker, mappings) {
    this._currentLine = currentLine;
    this._lineNumber = lineNumber;
    this._currentWorker = currentWorker;
    Severity: Major
    Found in lambdas/bulkUpload/classes/workerCSVValidator.js - About 3 days to fix

      File worker.js has 1288 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      const dayjs = require('dayjs');
      const { Op } = require('sequelize');
       
      module.exports = function (sequelize, DataTypes) {
      const Worker = sequelize.define(
      Severity: Major
      Found in backend/server/models/worker.js - About 3 days to fix

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

        const uploadedGet = async (req, res) => {
        try {
        const ignoreMetaDataObjects = /.*metadata.json$/;
        const ignoreRoot = /.*\/$/;
         
         
        Severity: Major
        Found in backend/server/routes/establishments/bulkUpload/uploaded.js and 1 other location - About 3 days to fix
        backend/server/routes/establishments/bulkUpload/uploadFiles.js on lines 53..112

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

        const uploadedGet = async (req, res) => {
        try {
        const ignoreMetaDataObjects = /.*metadata.json$/;
        const ignoreRoot = /.*\/$/;
         
         
        Severity: Major
        Found in backend/server/routes/establishments/bulkUpload/uploadFiles.js and 1 other location - About 3 days to fix
        backend/server/routes/establishments/bulkUpload/uploaded.js on lines 15..76

        File parent.js has 1265 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        // Local Authority user's report
        'use strict';
         
        // external node modules
        const moment = require('moment');
        Severity: Major
        Found in backend/server/routes/reports/wdf/parent.js - About 3 days to fix

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

          up: (queryInterface) => {
          return queryInterface.sequelize.transaction(async (transaction) => {
          await Promise.all([
          queryInterface.sequelize.query(
          'update cqc."Job" set "JobName"=\'Activities worker, coordinator\' where "JobID"=1',
          Severity: Major
          Found in backend/migrations/20221012110537-updateJobRolesList.js and 1 other location - About 3 days to fix
          backend/migrations/20221012110537-updateJobRolesList.js on lines 122..238

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

          down: (queryInterface) => {
          return queryInterface.sequelize.transaction(async (transaction) => {
          await Promise.all([
          queryInterface.sequelize.query(
          'update cqc."Job" set "JobName"=\'Activities worker or co-ordinator\' where "JobID"=1',
          Severity: Major
          Found in backend/migrations/20221012110537-updateJobRolesList.js and 1 other location - About 3 days to fix
          backend/migrations/20221012110537-updateJobRolesList.js on lines 4..120

          WorkplaceCSVValidator has 161 functions (exceeds 20 allowed). Consider refactoring.
          Open

          class WorkplaceCSVValidator {
          constructor(currentLine, lineNumber, allCurrentEstablishments) {
          this._currentLine = currentLine;
          this._lineNumber = lineNumber;
          this._allCurrentEstablishments = allCurrentEstablishments;
          Severity: Major
          Found in backend/server/models/BulkImport/csv/workplaceCSVValidator.js - About 3 days to fix

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

            protected init(): void {
            this.jobs = this.route.snapshot.data.jobs;
            this.setupForm();
            this.setPreviousRoute();
            this.prefill();
            frontend/src/app/features/workplace/leavers/leavers.component.ts on lines 57..95

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

            protected init(): void {
            this.jobs = this.route.snapshot.data.jobs;
            this.setupForm();
            this.setPreviousRoute();
            this.prefill();
            frontend/src/app/features/workplace/starters/starters.component.ts on lines 60..99

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

            BLACK: {
            OVRREGULAR: {
            A: 2,
            B: 6,
            C: 7,
            Severity: Major
            Found in backend/server/routes/reports/wdf/parent.js and 1 other location - About 3 days to fix
            backend/server/routes/reports/wdf/parent.js on lines 436..545

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

            RED: {
            OVRREGULAR: {
            A: 2,
            B: 6,
            C: 7,
            Severity: Major
            Found in backend/server/routes/reports/wdf/parent.js and 1 other location - About 3 days to fix
            backend/server/routes/reports/wdf/parent.js on lines 326..435

            File user.js has 1148 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // Local Authority user's report
            'use strict';
             
            //external node modules
            const moment = require('moment');
            Severity: Major
            Found in backend/server/routes/reports/localAuthorityReport/user.js - About 2 days to fix

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

              down: async (queryInterface) => {
              return queryInterface.sequelize.transaction(async (transaction) => {
              await Promise.all([
              await queryInterface.sequelize.query(
              `UPDATE cqc."TrainingCategories"
              Severity: Major
              Found in backend/migrations/20230110093114-updateTrainingCategories.js and 1 other location - About 2 days to fix
              backend/migrations/20230110093114-updateTrainingCategories.js on lines 5..112

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

              up: async (queryInterface) => {
              return queryInterface.sequelize.transaction(async (transaction) => {
              await Promise.all([
              await queryInterface.sequelize.query(
              `UPDATE cqc."TrainingCategories"
              Severity: Major
              Found in backend/migrations/20230110093114-updateTrainingCategories.js and 1 other location - About 2 days to fix
              backend/migrations/20230110093114-updateTrainingCategories.js on lines 114..221

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

              async down(queryInterface) {
              return queryInterface.sequelize.transaction(async (transaction) => {
              await models.workerTrainingCategories.update(
              { category: 'Moving and handling' },
              {
              Severity: Major
              Found in backend/migrations/20240424143655-renameTrainingCategories.js and 1 other location - About 2 days to fix
              backend/migrations/20240424143655-renameTrainingCategories.js on lines 6..118

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

              async up(queryInterface) {
              return queryInterface.sequelize.transaction(async (transaction) => {
              await models.workerTrainingCategories.update(
              { category: 'Assisting and moving people' },
              {
              Severity: Major
              Found in backend/migrations/20240424143655-renameTrainingCategories.js and 1 other location - About 2 days to fix
              backend/migrations/20240424143655-renameTrainingCategories.js on lines 120..232

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

              module.exports = {
              up: (queryInterface, Sequelize) => {
              const createTable = (queryInterface, tableName, column = null, transaction) => {
              return queryInterface.createTable(
              tableName,
              backend/migrations/20230515154430-TurnoverByEstablishmentId.js on lines 3..110
              backend/migrations/20230515155840-VacanciesByEstablishmentId.js on lines 3..110

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

              module.exports = {
              up: (queryInterface, Sequelize) => {
              const createTable = (queryInterface, tableName, column = null, transaction) => {
              return queryInterface.createTable(
              tableName,
              backend/migrations/20230515143502-QualificationsByEstablishmentId.js on lines 3..110
              backend/migrations/20230515154430-TurnoverByEstablishmentId.js on lines 3..110
              Severity
              Category
              Status
              Source
              Language