"Fossies" - the Fresh Open Source Software Archive

Member "cli-1.1280.1/packages/snyk-fix/src/plugins/python/handlers/pipenv-pipfile/index.ts" (20 Feb 2024, 1267 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 * as debugLib from 'debug';
    2 import * as ora from 'ora';
    3 
    4 import { EntityToFix, FixOptions } from '../../../../types';
    5 import { checkPackageToolSupported } from '../../../package-tool-supported';
    6 import { PluginFixResponse } from '../../../types';
    7 import { updateDependencies } from './update-dependencies';
    8 
    9 const debug = debugLib('snyk-fix:python:Pipfile');
   10 
   11 export async function pipenvPipfile(
   12   fixable: EntityToFix[],
   13   options: FixOptions,
   14 ): Promise<PluginFixResponse> {
   15   debug(`Preparing to fix ${fixable.length} Python Pipfile projects`);
   16   const handlerResult: PluginFixResponse = {
   17     succeeded: [],
   18     failed: [],
   19     skipped: [],
   20   };
   21 
   22   await checkPackageToolSupported('pipenv', options);
   23   for (const [index, entity] of fixable.entries()) {
   24     const spinner = ora({ isSilent: options.quiet, stream: process.stdout });
   25     const spinnerMessage = `Fixing Pipfile ${index + 1}/${fixable.length}`;
   26     spinner.text = spinnerMessage;
   27     spinner.start();
   28 
   29     const { failed, succeeded, skipped } = await updateDependencies(
   30       entity,
   31       options,
   32     );
   33     handlerResult.succeeded.push(...succeeded);
   34     handlerResult.failed.push(...failed);
   35     handlerResult.skipped.push(...skipped);
   36     spinner.stop();
   37   }
   38 
   39   return handlerResult;
   40 }