cityssm/node-faster-report-parser

View on GitHub

Showing 8 of 15 total issues

Consider simplifying this complex logical expression.
Open

      } else if (isDataRow(row)) {
        results.data.at(-1)?.items.push({
          itemNumber: row[0] ?? '',
          itemName: row[1] ?? '',
          binLocation: row[3] ?? '',
Severity: Critical
Found in xlsxReports/inventory/w200.inventory.ts - About 3 hrs to fix

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

    export async function parseFasterCsvReport<T>(
      pathToCsvFile: string,
      parsingOptions: ParseFasterCsvReportOptions<T>
    ): Promise<FasterCsvReportResults<T>> {
      // eslint-disable-next-line security/detect-non-literal-fs-filename
    Severity: Major
    Found in csvReports.ts - About 2 hrs to fix

      Function parseW311ExcelReport has 60 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      export function parseW311ExcelReport(
        pathToXlsxFile: string
      ): W311ExcelReportResults {
        const workbook = getXLSXWorkBook(pathToXlsxFile)
      
      
      Severity: Major
      Found in xlsxReports/maintenance/w311.activeWorkOrdersByShop.ts - About 2 hrs to fix

        Function extractReportMetadata has 55 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

        export function extractReportMetadata(
          workbook: XLSX.WorkBook,
          options: ExtractReportMetadataOptions
        ): FasterExcelReportResults {
          const lastSheet = workbook.Sheets[workbook.SheetNames.at(-1) as string]
        Severity: Major
        Found in xlsxReports/helpers.ts - About 2 hrs to fix

          Function parseW200ExcelReport has 43 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          export function parseW200ExcelReport(
            pathToXlsxFile: string
          ): W200ExcelReportResults {
            const workbook = getXLSXWorkBook(pathToXlsxFile)
          
          
          Severity: Minor
          Found in xlsxReports/inventory/w200.inventory.ts - About 1 hr to fix

            Function step has 41 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  step: (row) => {
                    const rawRowDataList = row.data as unknown as string[]
            
                    if (headerArray === undefined) {
                      headerArray = rawRowDataList
            Severity: Minor
            Found in csvReports.ts - About 1 hr to fix

              Function extractReportMetadata has a Cognitive Complexity of 17 (exceeds 10 allowed). Consider refactoring.
              Open

              export function extractReportMetadata(
                workbook: XLSX.WorkBook,
                options: ExtractReportMetadataOptions
              ): FasterExcelReportResults {
                const lastSheet = workbook.Sheets[workbook.SheetNames.at(-1) as string]
              Severity: Minor
              Found in xlsxReports/helpers.ts - About 1 hr to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function parseW311ExcelReport has a Cognitive Complexity of 12 (exceeds 10 allowed). Consider refactoring.
              Open

              export function parseW311ExcelReport(
                pathToXlsxFile: string
              ): W311ExcelReportResults {
                const workbook = getXLSXWorkBook(pathToXlsxFile)
              
              
              Severity: Minor
              Found in xlsxReports/maintenance/w311.activeWorkOrdersByShop.ts - About 35 mins to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Severity
              Category
              Status
              Source
              Language