Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"parse-lcov": "^1.0.4",
"rimraf": "^6.0.1",
"semver": "^7.6.3",
"shell-quote": "^1.8.3",
"simple-git": "^3.26.0",
"ts-morph": "^24.0.0",
"tslib": "^2.6.2",
Expand Down Expand Up @@ -76,6 +77,7 @@
"@types/node": "^22.13.4",
"@types/react": "18.3.1",
"@types/react-dom": "18.3.0",
"@types/shell-quote": "^1.7.5",
"@vitejs/plugin-react": "^5.0.0",
"@vitest/coverage-v8": "1.3.1",
"@vitest/eslint-plugin": "^1.1.38",
Expand Down
3 changes: 1 addition & 2 deletions packages/plugin-coverage/src/lib/runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
createRunnerFiles,
ensureDirectoryExists,
executeProcess,
filePathToCliArg,
objectToCliArgs,
readJsonFile,
ui,
Expand Down Expand Up @@ -66,7 +65,7 @@ export async function createRunnerConfig(
return {
command: 'node',
args: [
filePathToCliArg(scriptPath),
scriptPath,
...objectToCliArgs({ runnerConfigPath, runnerOutputPath }),
],
configFile: runnerConfigPath,
Expand Down
15 changes: 3 additions & 12 deletions packages/plugin-eslint/src/lib/runner/lint.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,5 @@
import type { ESLint, Linter } from 'eslint';
import { platform } from 'node:os';
import {
distinct,
executeProcess,
filePathToCliArg,
toArray,
} from '@code-pushup/utils';
import { distinct, executeProcess, toArray } from '@code-pushup/utils';
import type { ESLintTarget } from '../config.js';
import { setupESLint } from '../setup.js';
import type { LinterOutput, RuleOptionsPerFile } from './types.js';
Expand All @@ -29,14 +23,11 @@ async function executeLint({
command: 'npx',
args: [
'eslint',
...(eslintrc ? [`--config=${filePathToCliArg(eslintrc)}`] : []),
...(eslintrc ? [`--config=${eslintrc}`] : []),
...(typeof eslintrc === 'object' ? ['--no-eslintrc'] : []),
'--no-error-on-unmatched-pattern',
'--format=json',
...toArray(patterns).map(pattern =>
// globs need to be escaped on Unix
platform() === 'win32' ? pattern : `'${pattern}'`,
),
...toArray(patterns),
],
ignoreExitCode: true,
cwd: process.cwd(),
Expand Down
3 changes: 1 addition & 2 deletions packages/plugin-js-packages/src/lib/runner/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import {
createRunnerFiles,
ensureDirectoryExists,
executeProcess,
filePathToCliArg,
isPromiseFulfilledResult,
isPromiseRejectedResult,
objectFromEntries,
Expand Down Expand Up @@ -39,7 +38,7 @@ export async function createRunnerConfig(
return {
command: 'node',
args: [
filePathToCliArg(scriptPath),
scriptPath,
...objectToCliArgs({ runnerConfigPath, runnerOutputPath }),
],
configFile: runnerConfigPath,
Expand Down
5 changes: 4 additions & 1 deletion packages/utils/src/lib/execute-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
spawn,
} from 'node:child_process';
import type { Readable, Writable } from 'node:stream';
import { quote } from 'shell-quote';
import { isVerbose } from './env.js';
import { formatCommandLog } from './format-command-log.js';
import { ui } from './logging.js';
Expand Down Expand Up @@ -157,13 +158,15 @@
);
}

const bin = [command, quote(args ?? [])].join(' ');

return new Promise((resolve, reject) => {
// shell:true tells Windows to use shell command for spawning a child process
const spawnedProcess = spawn(command, args ?? [], {
const spawnedProcess = spawn(bin, {
shell: true,
windowsHide: true,
...options,
}) as ChildProcessByStdio<Writable, Readable, Readable>;

Check warning

Code scanning / CodeQL

Unsafe shell command constructed from library input Medium

This shell argument which depends on
library input
is later used in a
shell command
.

// eslint-disable-next-line functional/no-let
let stdout = '';
Expand Down
2 changes: 1 addition & 1 deletion testing/test-nx-utils/src/lib/utils/nx.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ export async function nxShowProjectJson<T extends ProjectConfiguration>(
) {
const { code, stderr, stdout } = await executeProcess({
command: 'npx',
args: ['nx', 'show', `project --json ${project}`],
args: ['nx', 'show', 'project', '--json', project],
cwd,
});

Expand Down
Loading