code-pushup / cli

A CLI to run all kinds of code quality measurements to align your team with company goals
https://code-pushup.dev
MIT License
208 stars 12 forks source link

Bug Eslint Plugin: The command line is too long #529

Closed markusnissl closed 7 months ago

markusnissl commented 7 months ago

What happened?

I executed the eslint plugin inside nx monorepo await eslintPlugin(await eslintConfigFromNxProject('...')),

I get an error that the command line is too long. Digging into the plugin I found that eslint is called with a long list of arguments "'angular-eslint-prefer-standalone-component,angular-eslint-prefer-on-push-component-change-detection,...,,angular-eslint-template-eqeqeq,....." (around 9000-10000 characters)

What would you expect to happen?

The code pushup audit should run and not throw an error. I would have expected that eslint is called with a file and not with a list of command line arguments.

What steps did you take?

I cannot provide the details of the project but can provide some general stats that could help to reproduce the issue

The eslintrc.json in the root folder contains for [".ts", ".tsx"] "plugin:@nx/typescript", "@code-pushup/eslint-config/typescript" as plugins around 60 lines of nx boundaries configuration and around 40 lines of turining off eslint checks. The project itself contains in addition the angular eslint plugin

Code PushUp package version

0.22.8

What operation system are you on?

Windows

Node version

v20.11.1

Relevant log output

Plugins failed:
The command line is too long.

Error: Plugins failed: 1 errors: The command line is too long.
 at executePlugins ... @code-pushup/cli/index.js:1679:11

or traced to 
async function executeRunnerConfig(cfg, onProgress) {
  const { args, command, outputFile, outputTransform } = cfg;
  const { duration, date } = await executeProcess({
    command,
    args,
    observer: { onStdout: onProgress }
  });
ChristopherPHolder commented 7 months ago

Hmm interesting, both of the examples mentioned are for huge projects.

But i can reproduce this for a much smaller one:

https://github.com/push-based/user-flow/pull/262

As long as the extends includes "@code-pushup" and includes *.ts it will throw that error:

{
  "files": ["*.ts"],
  "extends": ["@code-pushup"]
},