"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/src/lib/plugins/sast/utils/testEmitter.ts" (20 Feb 2024, 1302 Bytes) of package /linux/misc/snyk-cli-1.1280.1.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TypeScript source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 import { emitter as codeEmitter } from '@snyk/code-client';
    2 import { spinner } from '../../../spinner';
    3 import * as debugLib from 'debug';
    4 
    5 export function analysisProgressUpdate(): void {
    6   let currentMessage = '';
    7   const showSpinner = (message: string): Promise<void> | undefined => {
    8     if (currentMessage === message) return;
    9 
   10     spinner.clear<void>(currentMessage)();
   11     currentMessage = message;
   12     return spinner(message);
   13   };
   14 
   15   codeEmitter.on('supportedFilesLoaded', () =>
   16     showSpinner(`Supported extensions loaded`),
   17   );
   18   codeEmitter.on('scanFilesProgress', (processed: number) =>
   19     showSpinner(`Scanning files: ${Math.round(processed / 100)}00`),
   20   );
   21   codeEmitter.on('createBundleProgress', (processed: number, total: number) =>
   22     showSpinner(`Batching file upload: ${processed} / ${total}`),
   23   );
   24   codeEmitter.on('uploadBundleProgress', (processed: number, total: number) =>
   25     showSpinner(`Upload progress: ${processed} / ${total}`),
   26   );
   27   codeEmitter.on('analyseProgress', (data: any) =>
   28     showSpinner(`${data.status}: ${Math.round(data.progress * 100)}%`),
   29   );
   30   codeEmitter.on('sendError', (error) => {
   31     throw error;
   32   });
   33   codeEmitter.on('apiRequestLog', (data) => {
   34     const debug = debugLib('snyk-code');
   35     debug('---> API request log ', data);
   36   });
   37 }